Skip to content

Commit

Permalink
Merge pull request #5 from mizlan/master
Browse files Browse the repository at this point in the history
fix: normal form on rational constructor
  • Loading branch information
thma committed Aug 31, 2022
2 parents fdea3ef + cc08cdd commit f1bedca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Data/BigDecimal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ instance Fractional BigDecimal where

-- | creates a BigDecimal from a 'Rational' value. 'RoundingAdvice' defines precision and rounding mode.
fromRatio :: Rational -> RoundingAdvice -> BigDecimal
fromRatio (x :% y) = divide (fromInteger x, fromInteger y)
fromRatio (x :% y) = nf . divide (fromInteger x, fromInteger y)

instance Real BigDecimal where
toRational (BigDecimal val scl) = toRational val * 10 ^^ (- fromNatural scl)
Expand Down

0 comments on commit f1bedca

Please sign in to comment.