packages feed

aern2-mp 0.2.16.0 → 0.2.16.1

raw patch · 3 files changed

+21/−4 lines, 3 filesdep ~mixed-types-numPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependency ranges changed: mixed-types-num

API changes (from Hackage documentation)

+ AERN2.MP.Float.Conversions: instance Numeric.MixedTypes.Literals.ConvertibleExactly (Numeric.MixedTypes.Literals.WithSample AERN2.MP.Float.Type.MPFloat GHC.Num.Integer.Integer) AERN2.MP.Float.Type.MPFloat
+ AERN2.MP.Float.Conversions: instance Numeric.MixedTypes.Literals.ConvertibleExactly (Numeric.MixedTypes.Literals.WithSample AERN2.MP.Float.Type.MPFloat GHC.Types.Int) AERN2.MP.Float.Type.MPFloat

Files

aern2-mp.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           aern2-mp-version:        0.2.16.0+version:        0.2.16.1 synopsis:       Multi-precision ball (interval) arithmetic description:    Please see the README on GitHub at <https://github.com/michalkonecny/aern2/#readme> category:       Math@@ -90,7 +90,7 @@     , deepseq     , hspec     , integer-logarithms-    , mixed-types-num >=0.6.1+    , mixed-types-num >=0.6.2     , reflection     , regex-tdfa     , template-haskell@@ -130,7 +130,7 @@     , deepseq     , hspec     , integer-logarithms-    , mixed-types-num >=0.6.1+    , mixed-types-num >=0.6.2     , reflection     , regex-tdfa     , template-haskell
changelog.md view
@@ -1,6 +1,6 @@ # Change log for aern2-mp -* v 0.2.16.0 2024-09-21+* v 0.2.16.1 2024-10-06   * adapt to int / rat conversion with sample * v 0.2.15 2023-04-11   * add generic selectCountable, instance for Kleenean
src/AERN2/MP/Float/Conversions.hs view
@@ -55,8 +55,25 @@     safeConvertExactly =       Right . MPFloat . P.fromInteger +instance ConvertibleExactly (WithSample MPFloat Integer) MPFloat where+    safeConvertExactly (WithSample sampleMPFloat n) =+      fmap increasePrecisionToP (safeConvertExactly n)+      where+        p = if isFinite sampleMPFloat then getPrecision sampleMPFloat else (prec 2)+        increasePrecisionToP v +          | vp >= p = v+          | otherwise = setPrecision p v+          where+            vp = getPrecision v+            instance ConvertibleExactly Int MPFloat where     safeConvertExactly = safeConvertExactly . integer++instance ConvertibleExactly (WithSample MPFloat Int) MPFloat where+    safeConvertExactly (WithSample sampleMPFloat n) =+      fmap (setPrecision p) (safeConvertExactly n)+      where+        p = getPrecision sampleMPFloat  fromIntegerCEDU :: Precision -> Integer -> BoundsCEDU MPFloat fromIntegerCEDU pp =