Skip to content

Commit

Permalink
fix: normal form on rational constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
mizlan committed Aug 30, 2022
1 parent fdea3ef commit cc08cdd
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 cc08cdd

Please sign in to comment.