scientific 0.3.3.6 → 0.3.3.7
raw patch · 4 files changed
+25/−7 lines, 4 files
Files
- changelog +14/−0
- scientific.cabal +1/−1
- src/Data/Scientific.hs +4/−3
- test/test.hs +6/−3
changelog view
@@ -1,3 +1,17 @@+0.3.3.7+ * Fixed both the++ Prelude Data.Scientific> reads "0.0" :: [(Data.Scientific.Scientific,String)]+ [(0.0,".0"),(0.0,"")]++ problem and the++ read " 8" :: Scientific fails, while read " 8" :: Double succeeds++ problem.++ Courtesy of neongreen.+ 0.3.3.6 * Fixed bug in the x / y method for Scientific. Since I was using the default implementation: `x * recip y` the operation would
scientific.cabal view
@@ -1,5 +1,5 @@ name: scientific-version: 0.3.3.6+version: 0.3.3.7 synopsis: Numbers represented using scientific notation description: @Data.Scientific@ provides a space efficient and arbitrary precision
src/Data/Scientific.hs view
@@ -95,7 +95,8 @@ import Data.Typeable (Typeable) import Math.NumberTheory.Logarithms (integerLog10') import qualified Numeric (floatToDigits)-import Text.Read (readPrec)+import qualified Text.Read as Read+import Text.Read (readPrec) import qualified Text.ParserCombinators.ReadPrec as ReadPrec import qualified Text.ParserCombinators.ReadP as ReadP import Text.ParserCombinators.ReadP ( ReadP )@@ -562,7 +563,7 @@ ---------------------------------------------------------------------- instance Read Scientific where- readPrec = ReadPrec.lift scientificP+ readPrec = Read.parens $ ReadPrec.lift (ReadP.skipSpaces >> scientificP) -- A strict pair data SP = SP !Integer {-# UNPACK #-}!Int@@ -583,7 +584,7 @@ SP (step a digit) (e-1)) s SP coeff expnt <- (ReadP.satisfy (== '.') >> fractional)- `mplus` return s+ ReadP.<++ return s let signedCoeff | pos = coeff | otherwise = (-coeff)
test/test.hs view
@@ -44,9 +44,12 @@ s /= 0 QC.==> abs (Scientific.coefficient s) `mod` 10 /= 0) , testGroup "Parsing"- [ testCase "reads \"\"" $ testReads "" []- , testCase "reads \"1.\"" $ testReads "1." [(1.0, ".")]- , testCase "reads \"1.2e\"" $ testReads "1.2e" [(1.0, ".2e"), (1.2, "e")]+ [ testCase "reads \"\"" $ testReads "" []+ , testCase "reads \"1.\"" $ testReads "1." [(1.0, ".")]+ , testCase "reads \"1.2e\"" $ testReads "1.2e" [(1.2, "e")]+ , testCase "reads \"(1.3 )\"" $ testReads "(1.3 )" [(1.3, "")]+ , testCase "reads \"((1.3))\"" $ testReads "((1.3))" [(1.3, "")]+ , testCase "reads \" 1.3\"" $ testReads " 1.3" [(1.3, "")] ] , testGroup "Formatting"