Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Numeric/Decimal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,10 @@ fromFixedDecimal = coerce
-- Arith 123.458
-- >>> fromFixedDecimalBounded (123.458 :: Fixed E3) :: Arith (Decimal RoundToZero 3 Int8)
-- ArithError arithmetic overflow
-- ...
-- >>> fromFixedDecimalBounded (-123.458 :: Fixed E3) :: Arith (Decimal RoundToZero 3 Word)
-- ArithError arithmetic underflow
-- ...
--
-- @since 0.2.0
fromFixedDecimalBounded ::
Expand Down
1 change: 1 addition & 0 deletions src/Numeric/Decimal/BoundedArithmetic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ instance Bounded a => Bounded (Arith a) where
-- *** Exception: arithmetic underflow
-- >>> 1.1 - 123 :: Arith (Decimal RoundDown 3 Word)
-- ArithError arithmetic underflow
-- ...
--
-- @since 0.2.0
arithM :: MonadThrow m => Arith a -> m a
Expand Down
2 changes: 2 additions & 0 deletions src/Numeric/Decimal/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,10 @@ signumDecimalBounded d = fromIntegerDecimalBounded $ signumDecimal (toInteger <$
--
-- >>> -1.28 :: Arith (Decimal RoundHalfUp 2 Int8)
-- ArithError arithmetic overflow
-- ...
-- >>> negate (1.28 :: Arith (Decimal RoundHalfUp 2 Int8))
-- ArithError arithmetic overflow
-- ...
-- >>> :set -XNegativeLiterals
-- >>> -1.28 :: Arith (Decimal RoundHalfUp 2 Int8)
-- Arith -1.28
Expand Down
6 changes: 3 additions & 3 deletions tests/Numeric/DecimalSpec.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE TypeApplications #-}
Expand Down Expand Up @@ -398,9 +399,7 @@ spec = do
specRounding @4 @3 @Integer
specRounding @4 @4 @Integer




#if !MIN_VERSION_QuickCheck(2,15,0)
assertException :: (NFData a, Exception exc) =>
(exc -> Bool) -- ^ Return True if that is the exception that was expected
-> a -- ^ Value that should throw an exception, when fully evaluated
Expand All @@ -421,6 +420,7 @@ assertExceptionIO isExc action =
res `deepseq` return False) $ \exc ->
show exc `deepseq` return (isExc exc))
assert hasFailed
#endif

roundHalfUpTo :: Natural -> Rational -> Rational
roundHalfUpTo to rational =
Expand Down
Loading