ad 4.5.1 → 4.5.2
raw patch · 4 files changed
+41/−2 lines, 4 filesdep +tastydep +tasty-hunitdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: tasty, tasty-hunit
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG.markdown +6/−0
- ad.cabal +9/−1
- cbits/tape.c +1/−1
- tests/Regression.hs +25/−0
CHANGELOG.markdown view
@@ -1,3 +1,9 @@+4.5.2 [2022.06.17]+------------------+* Fix a bug that would cause `Numeric.AD.Mode.Reverse.diff` and+ `Numeric.AD.Mode.Reverse.Double.diff` to compute different answers under+ certain circumstances when `ad` was compiled with the `+ffi` flag.+ 4.5.1 [2022.05.18] ------------------ * Allow building with `transformers-0.6.*`.
ad.cabal view
@@ -1,5 +1,5 @@ name: ad-version: 4.5.1+version: 4.5.2 license: BSD3 license-File: LICENSE copyright: (c) Edward Kmett 2010-2021,@@ -203,6 +203,14 @@ ghc-options: -fspec-constr -fdicts-cheap -O2 x-docspec-extra-packages: distributive++test-suite regression+ default-language: Haskell2010+ type: exitcode-stdio-1.0+ main-is: Regression.hs+ hs-source-dirs: tests+ build-depends: ad, base, tasty, tasty-hunit+ ghc-options: -fspec-constr -fdicts-cheap -O2 benchmark blackscholes default-language: Haskell2010
cbits/tape.c view
@@ -104,7 +104,7 @@ buffer[j] += v*y; } }- idx += pTape->offset;+ idx += 1 + pTape->offset; pTape = pTape->prev; }
+ tests/Regression.hs view
@@ -0,0 +1,25 @@+module Main (main) where++import qualified Numeric.AD.Mode.Reverse as R+import qualified Numeric.AD.Mode.Reverse.Double as RD++import Test.Tasty+import Test.Tasty.HUnit++main :: IO ()+main = defaultMain tests++tests :: TestTree+tests = testGroup "Regression tests"+ [ testCase "#97" $+ assertBool "Reverse.diff and Reverse.Double.diff should behave identically" $+ nearZero $ R.diff f (0 :: Double) - RD.diff f (0 :: Double)+ ]++-- Reverse.Double +ffi initializes the tape with a block of size 4096+-- The large term in this function forces the allocation of an additional block+f :: Num a => a -> a+f = sum . replicate 5000++nearZero :: (Fractional a, Ord a) => a -> Bool+nearZero a = abs a <= 1e-12