rounded 0.1.0.1 → 0.2
raw patch · 9 files changed
+472/−184 lines, 9 filesdep −singletonsdep ~base
Dependencies removed: singletons
Dependency ranges changed: base
Files
- CHANGELOG.markdown +7/−0
- rounded.cabal +7/−6
- src/Numeric/MPFR/Raw/Safe.hs +91/−35
- src/Numeric/MPFR/Raw/Unsafe.hs +90/−34
- src/Numeric/Rounded.hs +79/−27
- src/Numeric/Rounded/Internal.hs +87/−35
- src/Numeric/Rounded/Precision.hs +1/−2
- src/Numeric/Rounded/Rounding.hs +0/−16
- src/Numeric/Rounded/Simple.hs +110/−29
CHANGELOG.markdown view
@@ -1,5 +1,12 @@ # Revision history for rounded +## 0.2 -- 2019-08-28++* Wrapped a lot more of the MPFR API.+* Fixed `wrapped_mpfr_set_ld()` FFI binding. Previously `fromLongDouble`+ could corrupt memory or crash due to missing argument.+* Removed dependency on `singletons`.+ ## 0.1.0.1 -- 2018-10-31 * License changed from LGPL to BSD3.
rounded.cabal view
@@ -1,5 +1,5 @@ name: rounded-version: 0.1.0.1+version: 0.2 synopsis: Correctly-rounded arbitrary-precision floating-point arithmetic homepage: https://github.com/ekmett/rounded bug-reports: https://github.com/ekmett/rounded/issues@@ -8,11 +8,11 @@ author: Edward A. Kmett, Daniel G. Peebles, Claude Heiland-Allen maintainer: Claude Heiland-Allen <claude@mathr.co.uk> copyright: Copyright (C) 2012-2014 Edward A. Kmett, Daniel G. Peebles;- Copyright (C) 2013-2018 Claude Heiland-Allen+ Copyright (C) 2013-2019 Claude Heiland-Allen category: Numeric, Math build-type: Simple cabal-version: 1.22-tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.1+tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.1, GHC == 8.8.1 description: This package provides numeric instances for MPFR that use \"Implicit Configurations\" from@@ -27,6 +27,8 @@ >>> :set -XDataKinds >>> exp pi :: Rounded TowardZero 512 23.140692632779269005729086367948547380266106242600211993445046409524342350690452783516971997067549219675952704801087773144428044414693835844717445879609842+ .+ rounded version 0.x is for MPFR version 3.1 or above. extra-source-files: README.markdown CHANGELOG.markdown test.hs test.txt @@ -37,7 +39,7 @@ source-repository this type: git location: git://github.com/ekmett/rounded.git- tag: rounded-0.1.0.1+ tag: rounded-0.2 library exposed-modules:@@ -55,10 +57,9 @@ Numeric.Rounded.Precision build-depends:- base >= 4.8 && < 4.13,+ base >= 4.8 && < 4.14, ghc-prim >= 0.4 && < 0.6, reflection >= 2.1.2 && < 2.2,- singletons >= 2.1 && < 2.6, hgmp >= 0.1.1 && < 0.2, long-double >= 0.1 && < 0.2
src/Numeric/MPFR/Raw/Safe.hs view
@@ -1,9 +1,9 @@ {-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- |--- Module : Numeric.MPFR.Raw.Unsafe+-- Module : Numeric.MPFR.Raw.Safe -- Copyright : (C) 2012-2014 Edward Kmett, Daniel Peebles--- (C) 2013-2017 Claude Heiland-Allen+-- (C) 2013-2019 Claude Heiland-Allen -- License : BSD3 -- Maintainer : Claude Heiland-Allen <claude@mathr.co.uk> -- Stability : experimental@@ -37,16 +37,30 @@ foreign import ccall safe "mpfr_set_q" mpfr_set_q :: Ptr MPFR -> Ptr MPQ -> MPFRRnd -> IO CInt foreign import ccall safe "mpfr_set_d" mpfr_set_d :: Ptr MPFR -> Double -> MPFRRnd -> IO CInt +foreign import ccall safe "wrapped_mpfr_get_z_2exp" wrapped_mpfr_get_z_2exp :: Ptr MPZ -> Ptr MPFR -> Ptr CInt -> IO MPFRExp+foreign import ccall safe "mpfr_set_z_2exp" mpfr_set_z_2exp :: Ptr MPFR -> Ptr MPZ -> MPFRExp -> MPFRRnd -> IO CInt+ type Test = Ptr MPFR -> IO CInt -foreign import ccall safe "mpfr_nan_p" mpfr_nan_p :: Test foreign import ccall safe "mpfr_inf_p" mpfr_inf_p :: Test-foreign import ccall safe "mpfr_zero_p" mpfr_zero_p :: Test+foreign import ccall safe "mpfr_integer_p" mpfr_integer_p :: Test+foreign import ccall safe "mpfr_nan_p" mpfr_nan_p :: Test+foreign import ccall safe "mpfr_number_p" mpfr_number_p :: Test+foreign import ccall safe "mpfr_regular_p" mpfr_regular_p :: Test foreign import ccall safe "mpfr_signbit" mpfr_signbit :: Test+foreign import ccall safe "mpfr_zero_p" mpfr_zero_p :: Test -foreign import ccall safe "wrapped_mpfr_get_z_2exp" wrapped_mpfr_get_z_2exp :: Ptr MPZ -> Ptr MPFR -> Ptr CInt -> IO MPFRExp-foreign import ccall safe "mpfr_set_z_2exp" mpfr_set_z_2exp :: Ptr MPFR -> Ptr MPZ -> MPFRExp -> MPFRRnd -> IO CInt+type Fits = Ptr MPFR -> MPFRRnd -> IO CInt +foreign import ccall safe "mpfr_fits_intmax_p" mpfr_fits_intmax_p :: Fits+foreign import ccall safe "mpfr_fits_sint_p" mpfr_fits_sint_p :: Fits+foreign import ccall safe "mpfr_fits_slong_p" mpfr_fits_slong_p :: Fits+foreign import ccall safe "mpfr_fits_sshort_p" mpfr_fits_sshort_p :: Fits+foreign import ccall safe "mpfr_fits_uintmax_p" mpfr_fits_uintmax_p :: Fits+foreign import ccall safe "mpfr_fits_uint_p" mpfr_fits_uint_p :: Fits+foreign import ccall safe "mpfr_fits_ulong_p" mpfr_fits_ulong_p :: Fits+foreign import ccall safe "mpfr_fits_ushort_p" mpfr_fits_ushort_p :: Fits+ type Constant = Ptr MPFR -> MPFRRnd -> IO CInt foreign import ccall safe "mpfr_const_pi" mpfr_const_pi :: Constant@@ -56,61 +70,103 @@ type Unary = Ptr MPFR -> Ptr MPFR -> MPFRRnd -> IO CInt -foreign import ccall safe "mpfr_set" mpfr_set :: Unary- foreign import ccall safe "mpfr_abs" mpfr_abs :: Unary-foreign import ccall safe "mpfr_neg" mpfr_neg :: Unary-foreign import ccall safe "mpfr_log" mpfr_log :: Unary-foreign import ccall safe "mpfr_exp" mpfr_exp :: Unary-foreign import ccall safe "mpfr_sqrt" mpfr_sqrt :: Unary-foreign import ccall safe "mpfr_sin" mpfr_sin :: Unary-foreign import ccall safe "mpfr_cos" mpfr_cos :: Unary-foreign import ccall safe "mpfr_tan" mpfr_tan :: Unary-foreign import ccall safe "mpfr_asin" mpfr_asin :: Unary foreign import ccall safe "mpfr_acos" mpfr_acos :: Unary-foreign import ccall safe "mpfr_atan" mpfr_atan :: Unary-foreign import ccall safe "mpfr_sinh" mpfr_sinh :: Unary-foreign import ccall safe "mpfr_cosh" mpfr_cosh :: Unary-foreign import ccall safe "mpfr_tanh" mpfr_tanh :: Unary-foreign import ccall safe "mpfr_asinh" mpfr_asinh :: Unary foreign import ccall safe "mpfr_acosh" mpfr_acosh :: Unary+foreign import ccall safe "mpfr_ai" mpfr_ai :: Unary+foreign import ccall safe "mpfr_asin" mpfr_asin :: Unary+foreign import ccall safe "mpfr_asinh" mpfr_asinh :: Unary+foreign import ccall safe "mpfr_atan" mpfr_atan :: Unary foreign import ccall safe "mpfr_atanh" mpfr_atanh :: Unary-foreign import ccall safe "mpfr_log1p" mpfr_log1p :: Unary+foreign import ccall safe "mpfr_cbrt" mpfr_cbrt :: Unary+foreign import ccall safe "mpfr_cos" mpfr_cos :: Unary+foreign import ccall safe "mpfr_cosh" mpfr_cosh :: Unary+foreign import ccall safe "mpfr_cot" mpfr_cot :: Unary+foreign import ccall safe "mpfr_coth" mpfr_coth :: Unary+foreign import ccall safe "mpfr_csc" mpfr_csc :: Unary+foreign import ccall safe "mpfr_csch" mpfr_csch :: Unary+foreign import ccall safe "mpfr_digamma" mpfr_digamma :: Unary+foreign import ccall safe "mpfr_eint" mpfr_eint :: Unary+foreign import ccall safe "mpfr_erf" mpfr_erf :: Unary+foreign import ccall safe "mpfr_erfc" mpfr_erfc :: Unary+foreign import ccall safe "mpfr_exp" mpfr_exp :: Unary+foreign import ccall safe "mpfr_exp10" mpfr_exp10 :: Unary+foreign import ccall safe "mpfr_exp2" mpfr_exp2 :: Unary foreign import ccall safe "mpfr_expm1" mpfr_expm1 :: Unary+foreign import ccall safe "mpfr_frac" mpfr_frac :: Unary+foreign import ccall safe "mpfr_gamma" mpfr_gamma :: Unary+foreign import ccall safe "mpfr_j0" mpfr_j0 :: Unary+foreign import ccall safe "mpfr_j1" mpfr_j1 :: Unary+foreign import ccall safe "mpfr_li2" mpfr_li2 :: Unary+foreign import ccall safe "mpfr_lngamma" mpfr_lngamma :: Unary+foreign import ccall safe "mpfr_log" mpfr_log :: Unary+foreign import ccall safe "mpfr_log10" mpfr_log10 :: Unary+foreign import ccall safe "mpfr_log1p" mpfr_log1p :: Unary+foreign import ccall safe "mpfr_log2" mpfr_log2 :: Unary+foreign import ccall safe "mpfr_neg" mpfr_neg :: Unary+foreign import ccall safe "mpfr_rec_sqrt" mpfr_rec_sqrt :: Unary foreign import ccall safe "mpfr_rint" mpfr_rint :: Unary+foreign import ccall safe "mpfr_rint_ceil" mpfr_rint_ceil :: Unary+foreign import ccall safe "mpfr_rint_floor" mpfr_rint_floor :: Unary+foreign import ccall safe "mpfr_rint_round" mpfr_rint_round :: Unary+foreign import ccall safe "mpfr_rint_roundeven" mpfr_rint_roundeven :: Unary+foreign import ccall safe "mpfr_rint_trunc" mpfr_rint_trunc :: Unary+foreign import ccall safe "mpfr_sec" mpfr_sec :: Unary+foreign import ccall safe "mpfr_sech" mpfr_sech :: Unary+foreign import ccall safe "mpfr_set" mpfr_set :: Unary+foreign import ccall safe "mpfr_sin" mpfr_sin :: Unary+foreign import ccall safe "mpfr_sinh" mpfr_sinh :: Unary+foreign import ccall safe "mpfr_sqr" mpfr_sqr :: Unary+foreign import ccall safe "mpfr_sqrt" mpfr_sqrt :: Unary+foreign import ccall safe "mpfr_tan" mpfr_tan :: Unary+foreign import ccall safe "mpfr_tanh" mpfr_tanh :: Unary+foreign import ccall safe "mpfr_y0" mpfr_y0 :: Unary+foreign import ccall safe "mpfr_y1" mpfr_y1 :: Unary+foreign import ccall safe "mpfr_zeta" mpfr_zeta :: Unary type Unary' = Ptr MPFR -> Ptr MPFR -> IO CInt -foreign import ccall safe "mpfr_trunc" mpfr_trunc :: Unary' foreign import ccall safe "mpfr_ceil" mpfr_ceil :: Unary' foreign import ccall safe "mpfr_floor" mpfr_floor :: Unary'+foreign import ccall safe "mpfr_trunc" mpfr_trunc :: Unary' type Binary = Ptr MPFR -> Ptr MPFR -> Ptr MPFR -> MPFRRnd -> IO CInt foreign import ccall safe "mpfr_add" mpfr_add :: Binary-foreign import ccall safe "mpfr_sub" mpfr_sub :: Binary-foreign import ccall safe "mpfr_mul" mpfr_mul :: Binary+foreign import ccall safe "mpfr_agm" mpfr_agm :: Binary+foreign import ccall safe "mpfr_atan2" mpfr_atan2 :: Binary+foreign import ccall safe "mpfr_copysign" mpfr_copysign :: Binary+foreign import ccall safe "mpfr_dim" mpfr_dim :: Binary foreign import ccall safe "mpfr_div" mpfr_div :: Binary-foreign import ccall safe "mpfr_min" mpfr_min :: Binary+foreign import ccall safe "mpfr_fmod" mpfr_fmod :: Binary+foreign import ccall safe "mpfr_hypot" mpfr_hypot :: Binary foreign import ccall safe "mpfr_max" mpfr_max :: Binary-foreign import ccall safe "mpfr_atan2" mpfr_atan2 :: Binary+foreign import ccall safe "mpfr_min" mpfr_min :: Binary+foreign import ccall safe "mpfr_mul" mpfr_mul :: Binary+foreign import ccall safe "mpfr_pow" mpfr_pow :: Binary+foreign import ccall safe "mpfr_sub" mpfr_sub :: Binary -foreign import ccall safe "mpfr_modf" mpfr_modf :: Binary+type DualOutput = Ptr MPFR -> Ptr MPFR -> Ptr MPFR -> MPFRRnd -> IO CInt +foreign import ccall safe "mpfr_modf" mpfr_modf :: DualOutput+foreign import ccall safe "mpfr_sin_cos" mpfr_sin_cos :: DualOutput+foreign import ccall safe "mpfr_sinh_cosh" mpfr_sinh_cosh :: DualOutput+ type Comparison = Ptr MPFR -> Ptr MPFR -> IO CInt -foreign import ccall safe "mpfr_cmp" mpfr_cmp :: Comparison-foreign import ccall safe "mpfr_equal_p" mpfr_equal_p :: Comparison-foreign import ccall safe "mpfr_lessgreater_p" mpfr_lessgreater_p :: Comparison-foreign import ccall safe "mpfr_less_p" mpfr_less_p :: Comparison-foreign import ccall safe "mpfr_greater_p" mpfr_greater_p :: Comparison-foreign import ccall safe "mpfr_lessequal_p" mpfr_lessequal_p :: Comparison+foreign import ccall safe "mpfr_cmp" mpfr_cmp :: Comparison+foreign import ccall safe "mpfr_equal_p" mpfr_equal_p :: Comparison foreign import ccall safe "mpfr_greaterequal_p" mpfr_greaterequal_p :: Comparison+foreign import ccall safe "mpfr_greater_p" mpfr_greater_p :: Comparison+foreign import ccall safe "mpfr_lessequal_p" mpfr_lessequal_p :: Comparison+foreign import ccall safe "mpfr_lessgreater_p" mpfr_lessgreater_p :: Comparison+foreign import ccall safe "mpfr_less_p" mpfr_less_p :: Comparison+foreign import ccall safe "mpfr_unordered_p" mpfr_unordered_p :: Comparison foreign import ccall safe "mpfr_nextabove" mpfr_nextabove :: Ptr MPFR -> IO () foreign import ccall safe "mpfr_nextbelow" mpfr_nextbelow :: Ptr MPFR -> IO () foreign import ccall safe "wrapped_mpfr_get_ld" wrapped_mpfr_get_ld :: Ptr LongDouble -> Ptr MPFR -> MPFRRnd -> Ptr CInt -> IO CInt foreign import ccall safe "wrapped_mpfr_get_ld_2exp" wrapped_mpfr_get_ld_2exp :: Ptr LongDouble -> Ptr CLong -> Ptr MPFR -> MPFRRnd -> Ptr CInt -> IO CInt-foreign import ccall safe "wrapped_mpfr_set_ld" wrapped_mpfr_set_ld :: Ptr MPFR -> Ptr LongDouble -> MPFRRnd -> IO CInt+foreign import ccall safe "wrapped_mpfr_set_ld" wrapped_mpfr_set_ld :: Ptr MPFR -> Ptr LongDouble -> MPFRRnd -> Ptr CInt -> IO CInt foreign import ccall safe "wrapped_mpfr_cmp_ld" wrapped_mpfr_cmp_ld :: Ptr MPFR -> Ptr LongDouble -> IO CInt
src/Numeric/MPFR/Raw/Unsafe.hs view
@@ -3,7 +3,7 @@ -- | -- Module : Numeric.MPFR.Raw.Unsafe -- Copyright : (C) 2012-2014 Edward Kmett, Daniel Peebles--- (C) 2013-2017 Claude Heiland-Allen+-- (C) 2013-2019 Claude Heiland-Allen -- License : BSD3 -- Maintainer : Claude Heiland-Allen <claude@mathr.co.uk> -- Stability : experimental@@ -37,16 +37,30 @@ foreign import ccall unsafe "mpfr_set_q" mpfr_set_q :: Ptr MPFR -> Ptr MPQ -> MPFRRnd -> IO CInt foreign import ccall unsafe "mpfr_set_d" mpfr_set_d :: Ptr MPFR -> Double -> MPFRRnd -> IO CInt +foreign import ccall unsafe "wrapped_mpfr_get_z_2exp" wrapped_mpfr_get_z_2exp :: Ptr MPZ -> Ptr MPFR -> Ptr CInt -> IO MPFRExp+foreign import ccall unsafe "mpfr_set_z_2exp" mpfr_set_z_2exp :: Ptr MPFR -> Ptr MPZ -> MPFRExp -> MPFRRnd -> IO CInt+ type Test = Ptr MPFR -> IO CInt -foreign import ccall unsafe "mpfr_nan_p" mpfr_nan_p :: Test foreign import ccall unsafe "mpfr_inf_p" mpfr_inf_p :: Test-foreign import ccall unsafe "mpfr_zero_p" mpfr_zero_p :: Test+foreign import ccall unsafe "mpfr_integer_p" mpfr_integer_p :: Test+foreign import ccall unsafe "mpfr_nan_p" mpfr_nan_p :: Test+foreign import ccall unsafe "mpfr_number_p" mpfr_number_p :: Test+foreign import ccall unsafe "mpfr_regular_p" mpfr_regular_p :: Test foreign import ccall unsafe "mpfr_signbit" mpfr_signbit :: Test+foreign import ccall unsafe "mpfr_zero_p" mpfr_zero_p :: Test -foreign import ccall unsafe "wrapped_mpfr_get_z_2exp" wrapped_mpfr_get_z_2exp :: Ptr MPZ -> Ptr MPFR -> Ptr CInt -> IO MPFRExp-foreign import ccall unsafe "mpfr_set_z_2exp" mpfr_set_z_2exp :: Ptr MPFR -> Ptr MPZ -> MPFRExp -> MPFRRnd -> IO CInt+type Fits = Ptr MPFR -> MPFRRnd -> IO CInt +foreign import ccall unsafe "mpfr_fits_intmax_p" mpfr_fits_intmax_p :: Fits+foreign import ccall unsafe "mpfr_fits_sint_p" mpfr_fits_sint_p :: Fits+foreign import ccall unsafe "mpfr_fits_slong_p" mpfr_fits_slong_p :: Fits+foreign import ccall unsafe "mpfr_fits_sshort_p" mpfr_fits_sshort_p :: Fits+foreign import ccall unsafe "mpfr_fits_uintmax_p" mpfr_fits_uintmax_p :: Fits+foreign import ccall unsafe "mpfr_fits_uint_p" mpfr_fits_uint_p :: Fits+foreign import ccall unsafe "mpfr_fits_ulong_p" mpfr_fits_ulong_p :: Fits+foreign import ccall unsafe "mpfr_fits_ushort_p" mpfr_fits_ushort_p :: Fits+ type Constant = Ptr MPFR -> MPFRRnd -> IO CInt foreign import ccall unsafe "mpfr_const_pi" mpfr_const_pi :: Constant@@ -56,61 +70,103 @@ type Unary = Ptr MPFR -> Ptr MPFR -> MPFRRnd -> IO CInt -foreign import ccall unsafe "mpfr_set" mpfr_set :: Unary- foreign import ccall unsafe "mpfr_abs" mpfr_abs :: Unary-foreign import ccall unsafe "mpfr_neg" mpfr_neg :: Unary-foreign import ccall unsafe "mpfr_log" mpfr_log :: Unary-foreign import ccall unsafe "mpfr_exp" mpfr_exp :: Unary-foreign import ccall unsafe "mpfr_sqrt" mpfr_sqrt :: Unary-foreign import ccall unsafe "mpfr_sin" mpfr_sin :: Unary-foreign import ccall unsafe "mpfr_cos" mpfr_cos :: Unary-foreign import ccall unsafe "mpfr_tan" mpfr_tan :: Unary-foreign import ccall unsafe "mpfr_asin" mpfr_asin :: Unary foreign import ccall unsafe "mpfr_acos" mpfr_acos :: Unary-foreign import ccall unsafe "mpfr_atan" mpfr_atan :: Unary-foreign import ccall unsafe "mpfr_sinh" mpfr_sinh :: Unary-foreign import ccall unsafe "mpfr_cosh" mpfr_cosh :: Unary-foreign import ccall unsafe "mpfr_tanh" mpfr_tanh :: Unary-foreign import ccall unsafe "mpfr_asinh" mpfr_asinh :: Unary foreign import ccall unsafe "mpfr_acosh" mpfr_acosh :: Unary+foreign import ccall unsafe "mpfr_ai" mpfr_ai :: Unary+foreign import ccall unsafe "mpfr_asin" mpfr_asin :: Unary+foreign import ccall unsafe "mpfr_asinh" mpfr_asinh :: Unary+foreign import ccall unsafe "mpfr_atan" mpfr_atan :: Unary foreign import ccall unsafe "mpfr_atanh" mpfr_atanh :: Unary-foreign import ccall unsafe "mpfr_log1p" mpfr_log1p :: Unary+foreign import ccall unsafe "mpfr_cbrt" mpfr_cbrt :: Unary+foreign import ccall unsafe "mpfr_cos" mpfr_cos :: Unary+foreign import ccall unsafe "mpfr_cosh" mpfr_cosh :: Unary+foreign import ccall unsafe "mpfr_cot" mpfr_cot :: Unary+foreign import ccall unsafe "mpfr_coth" mpfr_coth :: Unary+foreign import ccall unsafe "mpfr_csc" mpfr_csc :: Unary+foreign import ccall unsafe "mpfr_csch" mpfr_csch :: Unary+foreign import ccall unsafe "mpfr_digamma" mpfr_digamma :: Unary+foreign import ccall unsafe "mpfr_eint" mpfr_eint :: Unary+foreign import ccall unsafe "mpfr_erf" mpfr_erf :: Unary+foreign import ccall unsafe "mpfr_erfc" mpfr_erfc :: Unary+foreign import ccall unsafe "mpfr_exp" mpfr_exp :: Unary+foreign import ccall unsafe "mpfr_exp10" mpfr_exp10 :: Unary+foreign import ccall unsafe "mpfr_exp2" mpfr_exp2 :: Unary foreign import ccall unsafe "mpfr_expm1" mpfr_expm1 :: Unary+foreign import ccall unsafe "mpfr_frac" mpfr_frac :: Unary+foreign import ccall unsafe "mpfr_gamma" mpfr_gamma :: Unary+foreign import ccall unsafe "mpfr_j0" mpfr_j0 :: Unary+foreign import ccall unsafe "mpfr_j1" mpfr_j1 :: Unary+foreign import ccall unsafe "mpfr_li2" mpfr_li2 :: Unary+foreign import ccall unsafe "mpfr_lngamma" mpfr_lngamma :: Unary+foreign import ccall unsafe "mpfr_log" mpfr_log :: Unary+foreign import ccall unsafe "mpfr_log10" mpfr_log10 :: Unary+foreign import ccall unsafe "mpfr_log1p" mpfr_log1p :: Unary+foreign import ccall unsafe "mpfr_log2" mpfr_log2 :: Unary+foreign import ccall unsafe "mpfr_neg" mpfr_neg :: Unary+foreign import ccall unsafe "mpfr_rec_sqrt" mpfr_rec_sqrt :: Unary foreign import ccall unsafe "mpfr_rint" mpfr_rint :: Unary+foreign import ccall unsafe "mpfr_rint_ceil" mpfr_rint_ceil :: Unary+foreign import ccall unsafe "mpfr_rint_floor" mpfr_rint_floor :: Unary+foreign import ccall unsafe "mpfr_rint_round" mpfr_rint_round :: Unary+foreign import ccall unsafe "mpfr_rint_roundeven" mpfr_rint_roundeven :: Unary+foreign import ccall unsafe "mpfr_rint_trunc" mpfr_rint_trunc :: Unary+foreign import ccall unsafe "mpfr_sec" mpfr_sec :: Unary+foreign import ccall unsafe "mpfr_sech" mpfr_sech :: Unary+foreign import ccall unsafe "mpfr_set" mpfr_set :: Unary+foreign import ccall unsafe "mpfr_sin" mpfr_sin :: Unary+foreign import ccall unsafe "mpfr_sinh" mpfr_sinh :: Unary+foreign import ccall unsafe "mpfr_sqr" mpfr_sqr :: Unary+foreign import ccall unsafe "mpfr_sqrt" mpfr_sqrt :: Unary+foreign import ccall unsafe "mpfr_tan" mpfr_tan :: Unary+foreign import ccall unsafe "mpfr_tanh" mpfr_tanh :: Unary+foreign import ccall unsafe "mpfr_y0" mpfr_y0 :: Unary+foreign import ccall unsafe "mpfr_y1" mpfr_y1 :: Unary+foreign import ccall unsafe "mpfr_zeta" mpfr_zeta :: Unary type Unary' = Ptr MPFR -> Ptr MPFR -> IO CInt -foreign import ccall unsafe "mpfr_trunc" mpfr_trunc :: Unary' foreign import ccall unsafe "mpfr_ceil" mpfr_ceil :: Unary' foreign import ccall unsafe "mpfr_floor" mpfr_floor :: Unary'+foreign import ccall unsafe "mpfr_trunc" mpfr_trunc :: Unary' type Binary = Ptr MPFR -> Ptr MPFR -> Ptr MPFR -> MPFRRnd -> IO CInt foreign import ccall unsafe "mpfr_add" mpfr_add :: Binary-foreign import ccall unsafe "mpfr_sub" mpfr_sub :: Binary-foreign import ccall unsafe "mpfr_mul" mpfr_mul :: Binary+foreign import ccall unsafe "mpfr_agm" mpfr_agm :: Binary+foreign import ccall unsafe "mpfr_atan2" mpfr_atan2 :: Binary+foreign import ccall unsafe "mpfr_copysign" mpfr_copysign :: Binary+foreign import ccall unsafe "mpfr_dim" mpfr_dim :: Binary foreign import ccall unsafe "mpfr_div" mpfr_div :: Binary-foreign import ccall unsafe "mpfr_min" mpfr_min :: Binary+foreign import ccall unsafe "mpfr_fmod" mpfr_fmod :: Binary+foreign import ccall unsafe "mpfr_hypot" mpfr_hypot :: Binary foreign import ccall unsafe "mpfr_max" mpfr_max :: Binary-foreign import ccall unsafe "mpfr_atan2" mpfr_atan2 :: Binary+foreign import ccall unsafe "mpfr_min" mpfr_min :: Binary+foreign import ccall unsafe "mpfr_mul" mpfr_mul :: Binary+foreign import ccall unsafe "mpfr_pow" mpfr_pow :: Binary+foreign import ccall unsafe "mpfr_sub" mpfr_sub :: Binary -foreign import ccall unsafe "mpfr_modf" mpfr_modf :: Binary+type DualOutput = Ptr MPFR -> Ptr MPFR -> Ptr MPFR -> MPFRRnd -> IO CInt +foreign import ccall unsafe "mpfr_modf" mpfr_modf :: DualOutput+foreign import ccall unsafe "mpfr_sin_cos" mpfr_sin_cos :: DualOutput+foreign import ccall unsafe "mpfr_sinh_cosh" mpfr_sinh_cosh :: DualOutput+ type Comparison = Ptr MPFR -> Ptr MPFR -> IO CInt -foreign import ccall unsafe "mpfr_cmp" mpfr_cmp :: Comparison-foreign import ccall unsafe "mpfr_equal_p" mpfr_equal_p :: Comparison-foreign import ccall unsafe "mpfr_lessgreater_p" mpfr_lessgreater_p :: Comparison-foreign import ccall unsafe "mpfr_less_p" mpfr_less_p :: Comparison-foreign import ccall unsafe "mpfr_greater_p" mpfr_greater_p :: Comparison-foreign import ccall unsafe "mpfr_lessequal_p" mpfr_lessequal_p :: Comparison+foreign import ccall unsafe "mpfr_cmp" mpfr_cmp :: Comparison+foreign import ccall unsafe "mpfr_equal_p" mpfr_equal_p :: Comparison foreign import ccall unsafe "mpfr_greaterequal_p" mpfr_greaterequal_p :: Comparison+foreign import ccall unsafe "mpfr_greater_p" mpfr_greater_p :: Comparison+foreign import ccall unsafe "mpfr_lessequal_p" mpfr_lessequal_p :: Comparison+foreign import ccall unsafe "mpfr_lessgreater_p" mpfr_lessgreater_p :: Comparison+foreign import ccall unsafe "mpfr_less_p" mpfr_less_p :: Comparison+foreign import ccall unsafe "mpfr_unordered_p" mpfr_unordered_p :: Comparison foreign import ccall unsafe "mpfr_nextabove" mpfr_nextabove :: Ptr MPFR -> IO () foreign import ccall unsafe "mpfr_nextbelow" mpfr_nextbelow :: Ptr MPFR -> IO () foreign import ccall unsafe "wrapped_mpfr_get_ld" wrapped_mpfr_get_ld :: Ptr LongDouble -> Ptr MPFR -> MPFRRnd -> Ptr CInt -> IO CInt foreign import ccall unsafe "wrapped_mpfr_get_ld_2exp" wrapped_mpfr_get_ld_2exp :: Ptr LongDouble -> Ptr CLong -> Ptr MPFR -> MPFRRnd -> Ptr CInt -> IO CInt-foreign import ccall unsafe "wrapped_mpfr_set_ld" wrapped_mpfr_set_ld :: Ptr MPFR -> Ptr LongDouble -> MPFRRnd -> IO CInt+foreign import ccall unsafe "wrapped_mpfr_set_ld" wrapped_mpfr_set_ld :: Ptr MPFR -> Ptr LongDouble -> MPFRRnd -> Ptr CInt -> IO CInt foreign import ccall unsafe "wrapped_mpfr_cmp_ld" wrapped_mpfr_cmp_ld :: Ptr MPFR -> Ptr LongDouble -> IO CInt
src/Numeric/Rounded.hs view
@@ -2,7 +2,7 @@ -- | -- Module : Numeric.Rounded -- Copyright : (C) 2012-2014 Edward Kmett, Daniel Peebles--- (C) 2013-2018 Claude Heiland-Allen+-- (C) 2013-2019 Claude Heiland-Allen -- License : BSD3 -- Maintainer : Claude Heiland-Allen <claude@mathr.co.uk> -- Stability : experimental@@ -42,43 +42,95 @@ , succUlp , predUlp -- * Mixed-precision operations+ -- ** Unary+ , abs_+ , acos_+ , acosh_+ , ai_+ , asin_+ , asinh_+ , atan_+ , atanh_+ , cbrt_+ , cos_+ , cosh_+ , cot_+ , coth_+ , csc_+ , csch_+ , digamma_+ , eint_+ , erf_+ , erfc_+ , exp_+ , exp10_+ , exp2_+ , expm1_+ , frac_+ , gamma_+ , j0_+ , j1_+ , li2_+ , lngamma_+ , log_+ , log10_+ , log1p_+ , log2_+ , neg_+ , rec_sqrt_+ , rint_+ , rint_ceil_+ , rint_floor_+ , rint_round_+ , rint_roundeven_+ , rint_trunc_+ , sec_+ , sech_+ , set_+ , sin_+ , sinh_+ , sqr_+ , sqrt_+ , tan_+ , tanh_+ , y0_+ , y1_+ , zeta_+ -- ** Binary+ , add_+ , agm_+ , atan2_+ , copysign_+ , dim_+ , div_+ , fmod_+ , hypot_+ , max_+ , min_+ , mul_+ , pow_+ , sub_+ -- ** Dual output+ , modf+ , sin_cos+ , sinh_cosh+ -- ** Aliases , (!+!) , (!-!) , (!*!) , (!/!)- , abs_+ , (!**!) , negate_- , compare_+ , truncate_+ , ceiling_+ -- ** Comparisons , (!==!) , (!/=!) , (!>=!) , (!<=!) , (!>!) , (!<!)- , min_- , max_- , sqrt_- , exp_- , expm1_- , log_- , log1p_- , sin_- , cos_- , tan_- , asin_- , acos_- , atan_- , atan2_- , sinh_- , cosh_- , tanh_- , asinh_- , acosh_- , atanh_- , truncate_- , round_- , ceiling_- , floor_+ , (!<>!) -- * Foreign Function Interface , withInRounded , withInOutRounded
src/Numeric/Rounded/Internal.hs view
@@ -12,7 +12,7 @@ -- | -- Module : Numeric.Rounded.Internal -- Copyright : (C) 2012-2014 Edward Kmett, Daniel Peebles--- (C) 2013-2018 Claude Heiland-Allen+-- (C) 2013-2019 Claude Heiland-Allen -- License : BSD3 -- Maintainer : Claude Heiland-Allen <claude@mathr.co.uk> -- Stability : experimental@@ -175,32 +175,64 @@ infixl 6 .+., .-. infixl 7 .*. --abs_, negate_, log_, exp_, sqrt_,- sin_, cos_, tan_, asin_, acos_, atan_,- sinh_, cosh_, tanh_, asinh_, acosh_, atanh_,- log1p_, expm1_+abs_, acos_, acosh_, ai_, asin_, asinh_, atan_, atanh_, cbrt_, cos_, cosh_, cot_, coth_, csc_, csch_, digamma_, eint_, erf_, erfc_, exp_, exp10_, exp2_, expm1_, frac_, gamma_, j0_, j1_, li2_, lngamma_, log_, log10_, log1p_, log2_, neg_, rec_sqrt_, rint_, rint_ceil_, rint_floor_, rint_round_, rint_roundeven_, rint_trunc_, sec_, sech_, set_, sin_, sinh_, sqr_, sqrt_, tan_, tanh_, y0_, y1_, zeta_,+ negate_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2 abs_ = unary mpfr_abs-negate_ = unary mpfr_neg-log_ = unary mpfr_log-exp_ = unary mpfr_exp-sqrt_ = unary mpfr_sqrt-sin_ = unary mpfr_sin-cos_ = unary mpfr_cos-tan_ = unary mpfr_tan-asin_ = unary mpfr_asin acos_ = unary mpfr_acos-atan_ = unary mpfr_atan-sinh_ = unary mpfr_sinh-cosh_ = unary mpfr_cosh-tanh_ = unary mpfr_tanh-asinh_ = unary mpfr_asinh acosh_ = unary mpfr_acosh+ai_ = unary mpfr_ai+asin_ = unary mpfr_asin+asinh_ = unary mpfr_asinh+atan_ = unary mpfr_atan atanh_ = unary mpfr_atanh-log1p_ = unary mpfr_log1p+cbrt_ = unary mpfr_cbrt+cos_ = unary mpfr_cos+cosh_ = unary mpfr_cosh+cot_ = unary mpfr_cot+coth_ = unary mpfr_coth+csc_ = unary mpfr_csc+csch_ = unary mpfr_csch+digamma_ = unary mpfr_digamma+eint_ = unary mpfr_eint+erf_ = unary mpfr_erf+erfc_ = unary mpfr_erfc+exp_ = unary mpfr_exp+exp10_ = unary mpfr_exp10+exp2_ = unary mpfr_exp2 expm1_ = unary mpfr_expm1+frac_ = unary mpfr_frac+gamma_ = unary mpfr_gamma+j0_ = unary mpfr_j0+j1_ = unary mpfr_j1+li2_ = unary mpfr_li2+lngamma_ = unary mpfr_lngamma+log_ = unary mpfr_log+log10_ = unary mpfr_log10+log1p_ = unary mpfr_log1p+log2_ = unary mpfr_log2+neg_ = unary mpfr_neg+rec_sqrt_ = unary mpfr_rec_sqrt+rint_ = unary mpfr_rint+rint_ceil_ = unary mpfr_rint_ceil+rint_floor_ = unary mpfr_rint_floor+rint_round_ = unary mpfr_rint_round+rint_roundeven_ = unary mpfr_rint_roundeven+rint_trunc_ = unary mpfr_rint_trunc+sec_ = unary mpfr_sec+sech_ = unary mpfr_sech+set_ = unary mpfr_set+sin_ = unary mpfr_sin+sinh_ = unary mpfr_sinh+sqr_ = unary mpfr_sqr+sqrt_ = unary mpfr_sqrt+tan_ = unary mpfr_tan+tanh_ = unary mpfr_tanh+y0_ = unary mpfr_y0+y1_ = unary mpfr_y1+zeta_ = unary mpfr_zeta+negate_ = neg_ binary :: (Rounding r, Precision p1, Precision p2, Precision p3)@@ -212,19 +244,32 @@ f cfr afr bfr (rnd a) return c -min_, max_, (!+!), (!-!), (!*!), (!/!), atan2_+add_, agm_, atan2_, copysign_, dim_, div_, fmod_, hypot_, max_, min_, mul_, pow_, sub_,+ (!+!), (!-!), (!*!), (!/!), (!**!) :: (Rounding r, Precision p1, Precision p2, Precision p3) => Rounded r p1 -> Rounded r p2 -> Rounded r p3-min_ = binary mpfr_min-max_ = binary mpfr_max-(!+!) = binary mpfr_add-(!-!) = binary mpfr_sub-(!*!) = binary mpfr_mul-(!/!) = binary mpfr_div+add_ = binary mpfr_add+agm_ = binary mpfr_agm atan2_ = binary mpfr_atan2+copysign_ = binary mpfr_copysign+dim_ = binary mpfr_dim+div_ = binary mpfr_div+fmod_ = binary mpfr_fmod+hypot_ = binary mpfr_hypot+max_ = binary mpfr_max+min_ = binary mpfr_min+mul_ = binary mpfr_mul+pow_ = binary mpfr_pow+sub_ = binary mpfr_sub+(!+!) = add_+(!-!) = sub_+(!*!) = mul_+(!/!) = div_+(!**!) = pow_ -infixl 6 !+!, !-!-infixl 7 !*!, !/!+infixl 6 !+!, !-!, `add_`, `sub_`+infixl 7 !*!, !/!, `mul_`, `div_`+infixr 8 !**!, `pow_` binary' :: Rounding r => Binary -> Rounded r p -> Rounded r p -> Rounded r p binary' f a b = unsafePerformIO $ do@@ -243,7 +288,7 @@ cmp :: Comparison -> Rounded r p1 -> Rounded r p2 -> Bool cmp f a b = cmp' f a b /= 0 -(!==!), (!/=!), (!<=!), (!>=!), (!<!), (!>!)+(!==!), (!/=!), (!<=!), (!>=!), (!<!), (!>!), (!<>!) :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2 -> Bool (!==!) = cmp mpfr_equal_p@@ -252,8 +297,9 @@ (!>=!) = cmp mpfr_greaterequal_p (!<!) = cmp mpfr_less_p (!>!) = cmp mpfr_greater_p+(!<>!) = cmp mpfr_unordered_p -infix 4 !==!, !/=!, !<=!, !>=!, !<!, !>!+infix 4 !==!, !/=!, !<=!, !>=!, !<!, !>!, !<>! compare_ :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2 -> Ordering compare_ a b = compare (cmp' mpfr_cmp a b) 0@@ -326,7 +372,7 @@ fromLongDouble d = r where r = unsafePerformIO $ do- (Just x, _) <- out_ $ \xfr -> with d $ \dp -> wrapped_mpfr_set_ld xfr dp (rnd r)+ (Just x, _) <- out_ $ \xfr -> with d $ \dp -> with 0 $ \fp -> wrapped_mpfr_set_ld xfr dp (rnd r) fp return x -- TODO figure out correct syntax (if even possible) to allow RULE -- {-# RULES "realToFrac/fromLongDouble" realToFrac = fromLongDouble #-}@@ -355,6 +401,7 @@ exp = exp_ sqrt = sqrt_ log = log_+ (**) = pow_ sin = sin_ tan = tan_ cos = cos_@@ -381,12 +428,17 @@ instance (Rounding r, Precision p) => Real (Rounded r p) where toRational = toRational' -modf :: (Rounding r, Precision p) => Rounded r p -> (Rounded r p, Rounded r p)-modf x = unsafePerformIO $ do+modf, sin_cos, sinh_cosh :: (Rounding r, Precision p) => Rounded r p -> (Rounded r p, Rounded r p)+modf = dualOutput mpfr_modf+sin_cos = dualOutput mpfr_sin_cos+sinh_cosh = dualOutput mpfr_sinh_cosh++dualOutput :: (Rounding r, Precision p) => Binary -> Rounded r p -> (Rounded r p, Rounded r p)+dualOutput f x = unsafePerformIO $ do (Just y, (Just z, _)) <- in_ x $ \xfr -> out_ $ \yfr -> out_ $ \zfr ->- mpfr_modf yfr zfr xfr (rnd x)+ f yfr zfr xfr (rnd x) return (y, z) -- | Round to 'Integer' using the specified rounding mode. Throws 'Overflow' if
src/Numeric/Rounded/Precision.hs view
@@ -1,14 +1,13 @@ {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE MagicHash #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Rank2Types #-}-{-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_HADDOCK not-home #-} ----------------------------------------------------------------------------- -- |
src/Numeric/Rounded/Rounding.hs view
@@ -1,13 +1,8 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE KindSignatures #-}-{-# LANGUAGE MagicHash #-}-{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE Rank2Types #-}-{-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE TypeSynonymInstances #-} {-# OPTIONS_HADDOCK not-home #-} ----------------------------------------------------------------------------- -- |@@ -27,7 +22,6 @@ ) where import Data.Data-import Data.Singletons import Numeric.MPFR.Types @@ -71,16 +65,6 @@ instance Bounded RoundingMode where minBound = TowardNearestWithTiesAwayFromZero maxBound = Faithfully--newtype instance Sing (m :: RoundingMode) = SRounding RoundingMode--instance SingI TowardNearestWithTiesAwayFromZero where sing = SRounding TowardNearestWithTiesAwayFromZero-instance SingI TowardNearest where sing = SRounding TowardNearest-instance SingI TowardZero where sing = SRounding TowardZero-instance SingI TowardInf where sing = SRounding TowardInf-instance SingI TowardNegInf where sing = SRounding TowardNegInf-instance SingI AwayFromZero where sing = SRounding AwayFromZero-instance SingI Faithfully where sing = SRounding Faithfully reifyRounding :: RoundingMode -> (forall s. Rounding s => Proxy s -> r) -> r reifyRounding TowardNearestWithTiesAwayFromZero f = f (Proxy :: Proxy TowardNearestWithTiesAwayFromZero)
src/Numeric/Rounded/Simple.hs view
@@ -5,7 +5,7 @@ -- | -- Module : Numeric.Rounded.Simple -- Copyright : (C) 2012-2014 Edward Kmett, Daniel Peebles--- (C) 2013-2018 Claude Heiland-Allen+-- (C) 2013-2019 Claude Heiland-Allen -- License : BSD3 -- Maintainer : Claude Heiland-Allen <claude@mathr.co.uk> -- Stability : experimental@@ -62,6 +62,7 @@ , floor_ -- * Floating , sqrt_+ , pow_ , exp_ , expm1_ , log_@@ -97,6 +98,49 @@ , show' -- * Read , read'+ -- * Other operations+ -- ** Unary operation+ , ai_+ , cbrt_+ , cot_+ , coth_+ , csc_+ , csch_+ , digamma_+ , eint_+ , erf_+ , erfc_+ , exp10_+ , exp2_+ , frac_+ , gamma_+ , j0_+ , j1_+ , li2_+ , lngamma_+ , log10_+ , log2_+ , neg_+ , rec_sqrt_+ , rint_+ , rint_ceil_+ , rint_floor_+ , rint_round_+ , rint_roundeven_+ , rint_trunc_+ , sec_+ , sech_+ , set_+ , sqr_+ , y0_+ , y1_+ , zeta_+ -- ** Binary operations+ , agm_+ , copysign_+ , dim_+ , fmod_+ , hypot_ -- * Foreign Function Interface , withInRounded , withInOutRounded@@ -159,32 +203,63 @@ g :: (R.Rounding r, R.Precision p, R.Precision q) => proxy1 r -> proxy2 q -> (R.Rounded r p -> R.Rounded r q) -> R.Rounded r p -> Rounded g _ _ h b = simplify (h b) -abs_, negate_, log_, exp_, sqrt_,- sin_, cos_, tan_, asin_, acos_, atan_,- sinh_, cosh_, tanh_, asinh_, acosh_, atanh_,- log1p_, expm1_,- precRound :: RoundingMode -> Precision -> Rounded -> Rounded-+abs_, acos_, acosh_, ai_, asin_, asinh_, atan_, atanh_, cbrt_, cos_, cosh_, cot_, coth_, csc_, csch_, digamma_, eint_, erf_, erfc_, exp_, exp10_, exp2_, expm1_, frac_, gamma_, j0_, j1_, li2_, lngamma_, log_, log10_, log1p_, log2_, neg_, rec_sqrt_, rint_, rint_ceil_, rint_floor_, rint_round_, rint_roundeven_, rint_trunc_, sec_, sech_, set_, sin_, sinh_, sqr_, sqrt_, tan_, tanh_, y0_, y1_, zeta_, precRound, negate_+ :: RoundingMode -> Precision -> Rounded -> Rounded abs_ = unary R.abs_-negate_ = unary R.negate_-log_ = unary R.log_-exp_ = unary R.exp_-sqrt_ = unary R.sqrt_-sin_ = unary R.sin_-cos_ = unary R.cos_-tan_ = unary R.tan_-asin_ = unary R.asin_ acos_ = unary R.acos_-atan_ = unary R.atan_-sinh_ = unary R.sinh_-cosh_ = unary R.cosh_-tanh_ = unary R.tanh_-asinh_ = unary R.asinh_ acosh_ = unary R.acosh_+ai_ = unary R.ai_+asin_ = unary R.asin_+asinh_ = unary R.asinh_+atan_ = unary R.atan_ atanh_ = unary R.atanh_-log1p_ = unary R.log1p_+cbrt_ = unary R.cbrt_+cos_ = unary R.cos_+cosh_ = unary R.cosh_+cot_ = unary R.cot_+coth_ = unary R.coth_+csc_ = unary R.csc_+csch_ = unary R.csch_+digamma_ = unary R.digamma_+eint_ = unary R.eint_+erf_ = unary R.erf_+erfc_ = unary R.erfc_+exp_ = unary R.exp_+exp10_ = unary R.exp10_+exp2_ = unary R.exp2_ expm1_ = unary R.expm1_+frac_ = unary R.frac_+gamma_ = unary R.gamma_+j0_ = unary R.j0_+j1_ = unary R.j1_+li2_ = unary R.li2_+lngamma_ = unary R.lngamma_+log_ = unary R.log_+log10_ = unary R.log10_+log1p_ = unary R.log1p_+log2_ = unary R.log2_+neg_ = unary R.neg_+rec_sqrt_ = unary R.rec_sqrt_+rint_ = unary R.rint_+rint_ceil_ = unary R.rint_ceil_+rint_floor_ = unary R.rint_floor_+rint_round_ = unary R.rint_round_+rint_roundeven_ = unary R.rint_roundeven_+rint_trunc_ = unary R.rint_trunc_+sec_ = unary R.sec_+sech_ = unary R.sech_+set_ = unary R.set_+sin_ = unary R.sin_+sinh_ = unary R.sinh_+sqr_ = unary R.sqr_+sqrt_ = unary R.sqrt_+tan_ = unary R.tan_+tanh_ = unary R.tanh_+y0_ = unary R.y0_+y1_ = unary R.y1_+zeta_ = unary R.zeta_ precRound = unary R.precRound+negate_ = neg_ fromInt :: RoundingMode -> Precision -> Int -> Rounded fromInt = fromX R.fromInt@@ -216,15 +291,21 @@ binary' :: (forall r p q pq . (R.Rounding r, R.Precision p, R.Precision q, R.Precision pq) => R.Rounded r p -> R.Rounded r q -> R.Rounded r pq) -> Rounded -> Rounded -> Rounded binary' f a b = binary f R.TowardNearest (precision a `max` precision b) a b -min_, max_, add_, sub_, mul_, div_, atan2_ :: RoundingMode -> Precision -> Rounded -> Rounded -> Rounded--min_ = binary R.min_-max_ = binary R.max_-add_ = binary (R.!+!)-sub_ = binary (R.!-!)-mul_ = binary (R.!*!)-div_ = binary (R.!/!)+add_, agm_, atan2_, copysign_, dim_, div_, fmod_, hypot_, max_, min_, mul_, pow_, sub_+ :: RoundingMode -> Precision -> Rounded -> Rounded -> Rounded+add_ = binary R.add_+agm_ = binary R.agm_ atan2_ = binary R.atan2_+copysign_ = binary R.copysign_+dim_ = binary R.dim_+div_ = binary R.div_+fmod_ = binary R.fmod_+hypot_ = binary R.hypot_+max_ = binary R.max_+min_ = binary R.min_+mul_ = binary R.mul_+pow_ = binary R.pow_+sub_ = binary R.sub_ unary' :: (forall r p . (R.Rounding r, R.Precision p) => R.Rounded r p -> a) -> RoundingMode -> Rounded -> a unary' f r a = R.reifyRounding r (\pr -> reifyRounded a (\ra -> g pr f ra))