From 98c2a303f8b7ed10487addebb8290abab5fea474 Mon Sep 17 00:00:00 2001 From: Maciej Bielecki Date: Thu, 22 Feb 2018 01:28:27 +0100 Subject: [PATCH 1/2] Document saturating behavior of addition and multiplication --- src/Data/Int53.purs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Data/Int53.purs b/src/Data/Int53.purs index 3103f1e..a469f75 100644 --- a/src/Data/Int53.purs +++ b/src/Data/Int53.purs @@ -125,7 +125,29 @@ instance genericInt53 :: Generic Int53 where fromSpine _ = Nothing - +-- | Addition is saturating: +-- | +-- | ``` +-- | >>> top + fromInt 1 == top +-- | true +-- | ``` +-- | +-- | NOTE: Due to this, Int53 doesn't actually satisfy the associativity law +-- | for addition: +-- | +-- | ``` +-- | >>> top + (fromInt 1 + fromInt (-1)) +-- | (Int53 9007199254740991.0) +-- | >>> (top + fromInt 1) + fromInt (-1) +-- | (Int53 9007199254740990.0) +-- | ``` +-- | +-- | Multiplication is also saturating: +-- | +-- | ``` +-- | >>> top * fromInt 2 == top +-- | true +-- | ``` instance semiringInt53 :: Semiring Int53 where add (Int53 a) (Int53 b) = unsafeClamp $ add a b zero = Int53 zero From c5870c6279923d1324617190044c94755f8f72f1 Mon Sep 17 00:00:00 2001 From: Maciej Bielecki Date: Thu, 22 Feb 2018 08:36:42 +0100 Subject: [PATCH 2/2] Fix pulp build command line --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dc905d0..b536992 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,5 +8,5 @@ install: - npm install purescript pulp bower purescript-psa - bower install script: - - pulp build --censor-lib + - pulp build -- --censor-lib - pulp test