mixed-types-num 0.5.4.0 → 0.5.5.0
raw patch · 4 files changed
+21/−21 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Numeric.MixedTypes.Elementary: powUsingExpLog :: (CanLogSameType t, CanExpSameType t, CanMulSameType t, CanTestInteger t, CanTestZero t, CanRecipSameType t) => t -> t -> t -> t
+ Numeric.MixedTypes.Elementary: powUsingExpLog :: (CanLogSameType t, CanExpSameType t, CanTestInteger t, CanTestZero t) => t -> (t -> t -> t) -> (t -> t) -> t -> t -> t
- Numeric.MixedTypes.Power: powUsingMul :: (CanBeInteger e, CanMulSameType t) => t -> t -> e -> t
+ Numeric.MixedTypes.Power: powUsingMul :: CanBeInteger e => t -> (t -> t -> t) -> t -> e -> t
- Numeric.MixedTypes.Power: powUsingMulRecip :: (CanBeInteger e, CanMulSameType b, CanRecipSameType b) => b -> b -> e -> b
+ Numeric.MixedTypes.Power: powUsingMulRecip :: CanBeInteger e => t -> (t -> t -> t) -> (t -> t) -> t -> e -> t
Files
- changelog.md +2/−0
- mixed-types-num.cabal +2/−2
- src/Numeric/MixedTypes/Elementary.hs +5/−7
- src/Numeric/MixedTypes/Power.hs +12/−12
changelog.md view
@@ -1,5 +1,7 @@ # mixed-types-num change log +* v 0.5.5 2021-05-26+ * powUsingMulRecip etc with custom multiply and recip operations * v 0.5.4 2021-05-21 * remove Kleeneans (move them to aern2-mp) * v 0.5.3 2021-05-15
mixed-types-num.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: e8481fef82c6968e2cd9d5cd1e354653793e3030ec91c88a836dd8df6593752f+-- hash: c613a879e0e3fe6ca50f14dc60091f6ac942b46a43b05cca7e39e7461f3cf2a4 name: mixed-types-num-version: 0.5.4.0+version: 0.5.5.0 synopsis: Alternative Prelude with numeric and logic expressions typed bottom-up description: Please see the README on GitHub at <https://github.com/michalkonecny/mixed-types-num#readme> category: Math
src/Numeric/MixedTypes/Elementary.hs view
@@ -240,18 +240,16 @@ powUsingExpLog :: (CanLogSameType t, CanExpSameType t,- CanMulSameType t, CanTestInteger t,- CanTestZero t,- CanRecipSameType t)+ CanTestZero t) =>- t -> t -> t -> t-powUsingExpLog one b e =+ t -> (t -> t -> t) -> (t -> t) -> t -> t -> t+powUsingExpLog one mul' recip' b e = case certainlyIntegerGetIt e of Just n ->- powUsingMulRecip one b n+ powUsingMulRecip one mul' recip' b n Nothing ->- exp ((log b) * (e))+ exp ((log b) `mul'` (e)) {---- sine and cosine -----}
src/Numeric/MixedTypes/Power.hs view
@@ -44,7 +44,7 @@ -- import Numeric.MixedTypes.MinMaxAbs import Numeric.MixedTypes.AddSub import Numeric.MixedTypes.Ring-import Numeric.MixedTypes.Div+-- import Numeric.MixedTypes.Div () @@ -99,30 +99,30 @@ CN.lift2 unsafePow b e powUsingMul ::- (CanBeInteger e,- CanMulSameType t)+ (CanBeInteger e) =>- t -> t -> e -> t-powUsingMul one x nPre+ t -> (t -> t -> t) -> t -> e -> t+powUsingMul one mul' x nPre | n < 0 = error $ "powUsingMul is not defined for negative exponent " ++ show n | n == 0 = one | otherwise = aux n where+ (.*) = mul' n = integer nPre aux m | m == 1 = x | even m =- let s = aux (m `P.div` 2) in s * s+ let s = aux (m `P.div` 2) in s .* s | otherwise =- let s = aux ((m-1) `P.div` 2) in x * s * s+ let s = aux ((m-1) `P.div` 2) in x .* s .* s powUsingMulRecip ::- (CanBeInteger e, CanMulSameType b, CanRecipSameType b)+ (CanBeInteger e) =>- b -> b -> e -> b-powUsingMulRecip one x e- | eI < 0 = recip $ powUsingMul one x (negate eI)- | otherwise = powUsingMul one x eI+ t -> (t -> t -> t) -> (t -> t) -> t -> e -> t+powUsingMulRecip one mul' recip' x e+ | eI < 0 = recip' $ powUsingMul one mul' x (negate eI)+ | otherwise = powUsingMul one mul' x eI where eI = integer e