Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Instance Definitions for log1p, expm1, log1pexp, and log1mexp #111

Merged
merged 5 commits into from
Mar 12, 2024

Conversation

julmb
Copy link
Contributor

@julmb julmb commented Mar 11, 2024

This PR addresses #108. It builds on #110.

The derivatives for log1p and expm1 are pretty much the straightforward ones.

For log1pexp, we can do some adjustments to improve numerical stability:

f x = log (1 + exp x)
f' x = exp x / (1 + exp x) = 1 / (1 + exp (-x))

For log1mexp, we can do something even more clever:

f x = log (1 - exp x)
f' x = - exp x / (1 - exp x) = 1 / (1 - exp (-x)) = 1 / (- expm1 (-x))

In the end, I added the following instance definitions for the extra floating point functions:

log1p    = lift1 log1p $ recip . (+) 1
expm1    = lift1 expm1 exp
log1pexp = lift1 log1pexp $ recip . (+) 1 . exp . negate
log1mexp = lift1 log1mexp $ recip . negate . expm1 . negate

It would be nice if someone could double-check these for both correctness and considerations of numerical stability.

I also added some regression tests on these functions and their derivatives both for normal and extreme values where the previous default implementation were failing.

@RyanGlScott
Copy link
Collaborator

I, too, lack the expertise to say whether these definitions are correct and numerically precise, but they certainly pass the eyeball test.

Do you know why the tests produce different results on GHC 8.6 and earlier?

@julmb
Copy link
Contributor Author

julmb commented Mar 11, 2024

Do you know why the tests produce different results on GHC 8.6 and earlier?

I just looked into it and I believe it to be related to https://gitlab.haskell.org/ghc/ghc/-/issues/17125. In which case, the base included with old GHC versions simply calculates the wrong result. Not sure how to deal with that in the tests. Should we use CPP or is there a more elegant solution?

@RyanGlScott
Copy link
Collaborator

Ah, OK. In that case, I'm not sure that we can do much besides guarding the tests behind CPP.

@julmb
Copy link
Contributor Author

julmb commented Mar 11, 2024

Maybe my first call was wrong. According to its version of base, ghc-8.8.4 should not have the fix mentioned above yet. I will investigate tomorrow to see what's actually going on there.

@julmb
Copy link
Contributor Author

julmb commented Mar 12, 2024

Okay, the versioning of base is very confusing here. Both ghc-8.8.1 and ghc-8.8.4 ship with base-4.13.0.0, but these are not the same. And https://hackage.haskell.org/package/base-4.13.0.0 seems to show the source code of the one that ships with ghc-8.8.1, so I wrongly concluded that the fix for GHC issue #17125 was not applied in ghc-8.8.4 yet. Plus the changelog does not mention the change at all. I wish they would at least bump the version for stuff like this.

This also means that I cannot cleanly use the MIN_VERSION_base macro to exclude the test from precisely the broken versions. I decided to allow all versions >= 4.13.0, so that it will include the test for ghc-8.8.4, but not ghc-8.6.5. This test would be broken in ghc-8.8.1 since that one ships with the "old" base-4.13.0.0, but maybe that is okay since it is a test and the CI system uses ghc-8.8.4 anyway. If we want to be conservative, we would have to exclude everything up to base-4.14.1.0, since it seems that that is the earliest version that is guaranteed to include the fix.

Copy link
Collaborator

@RyanGlScott RyanGlScott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this!

I'm fine with the current CPP bounds. If someone really wants to test ad with GHC 8.8.1 at some point, we can always raise them later.

tests/Regression.hs Show resolved Hide resolved
@RyanGlScott RyanGlScott merged commit 56a2ef5 into ekmett:master Mar 12, 2024
10 checks passed
@julmb julmb deleted the extra branch March 12, 2024 11:52
RyanGlScott added a commit that referenced this pull request Apr 30, 2024
@sternenseemann
Copy link

sternenseemann commented May 28, 2024

I've experienced the regression tests introduced here failing reliably, but only on x86_64-darwin (not aarch64-darwin, aarch64-linux, x86_64-linux). Sample Log:

Running phase: setupCompilerEnvironmentPhase
Build with /nix/store/jw4wdi097y48kpwsyg9v4xrff0dzvd96-ghc-9.6.5.
Running phase: unpackPhase
unpacking source archive /nix/store/hjv5waxjisv2nww8vklkqlzwcfiw12a4-ad-4.5.6.tar.gz
source root is ad-4.5.6
setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file ad-4.5.6/tests/Regression.hs
Running phase: patchPhase
Running phase: compileBuildDriverPhase
setupCompileFlags: -package-db=/private/tmp/nix-build-ad-4.5.6.drv-0/tmp.StUeKIOmN0/setup-package.conf.d -j2 -threaded -rtsopts
[1 of 2] Compiling Main             ( Setup.lhs, /private/tmp/nix-build-ad-4.5.6.drv-0/tmp.StUeKIOmN0/Main.o )
[2 of 2] Linking Setup
Running phase: configurePhase
configureFlags: --verbose --prefix=/nix/store/7pbzrd2r6ivdfjfnc0lsy36q1r59yp7q-ad-4.5.6 --libdir=$prefix/lib/$compiler/lib --libsubdir=$abi/$libname --docdir=/nix/store/l7bxaac6am339ylrkf3wl7rhsgns91mi-ad-4.5.6-doc/share/doc/ad-4.5.6 --with-gcc=clang --package-db=/private/tmp/nix-build-ad-4.5.6.drv-0/tmp.StUeKIOmN0/package.conf.d --ghc-options=-j2 --enable-library-profiling --profiling-detail=exported-functions --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --disable-split-sections --enable-library-stripping --enable-executable-stripping --ghc-options=-haddock --extra-lib-dirs=/nix/store/j2l19sql3mc73fdmazzv8nw0jvq3hbdq-ncurses-6.4/lib --extra-lib-dirs=/nix/store/4c21nhy3hylrhxvllri3s9bn3yajqw74-libffi-3.4.6/lib --extra-lib-dirs=/nix/store/yk9s4pfjyfjch28gan4as6k6acw6jk6s-gmp-with-cxx-6.3.0/lib --extra-lib-dirs=/nix/store/m0mbzn96iwg89135rz58h7il7ar03k8p-libiconv-99/lib --extra-include-dirs=/nix/store/2419grj384lg233jqchamm73il9iyjxg-libcxx-16.0.6-dev/include --extra-lib-dirs=/nix/store/2yjr5xx0qn1cd72lc3l1mw8k90fg5lxs-libcxx-16.0.6/lib --extra-include-dirs=/nix/store/ga55lv3bpi744yxggpcjmkxv8sw5fz10-compiler-rt-libc-16.0.6-dev/include --extra-lib-dirs=/nix/store/6lgq76g4nxaxbi9x48b1bsg994iq5r4v-compiler-rt-libc-16.0.6/lib --extra-framework-dirs=/nix/store/4l6yyr4mxbhr5imn5sr9kbnmfg1cs6mi-apple-framework-CoreFoundation/Library/Frameworks
Using Parsec parser
Configuring ad-4.5.6...
Flags chosen: ffi=False, herbie=False
Dependency adjunctions >=4.4 && <5: using adjunctions-4.4.2
Dependency array >=0.4 && <0.6: using array-0.5.6.0
Dependency base >=4.9 && <5: using base-4.18.2.1
Dependency comonad >=4 && <6: using comonad-5.0.8
Dependency containers >=0.5 && <0.8: using containers-0.6.7
Dependency data-reify >=0.6 && <0.7: using data-reify-0.6.3
Dependency erf >=2.0 && <2.1: using erf-2.0.0.0
Dependency free >=4.6.1 && <6: using free-5.2
Dependency nats >=0.1.2 && <2: using nats-1.1.2
Dependency reflection >=1.4 && <3: using reflection-2.1.8
Dependency semigroups >=0.16 && <1: using semigroups-0.20
Dependency transformers >=0.5.2.0 && <0.7: using transformers-0.6.1.0
Dependency ad: using ad-4.5.6
Dependency base: using base-4.18.2.1
Dependency tasty: using tasty-1.4.3
Dependency tasty-hunit: using tasty-hunit-0.10.1
Source component graph:
    component lib
    component test:regression dependency lib
Configured component graph:
    component ad-4.5.6-1WRJjsCnjTC4FZorB43KOi
        include adjunctions-4.4.2-4iURKUgQrKS7atyO3QSdm7
        include array-0.5.6.0
        include base-4.18.2.1
        include comonad-5.0.8-25mhXRE9C8L1ZZaqNOc9vY
        include containers-0.6.7
        include data-reify-0.6.3-5pvj6HtNJh5K2KS7NgYUmS
        include erf-2.0.0.0-4xz1P35HuR5Dy4ovZUgjCU
        include free-5.2-JGEaoq8reB2HfhNMp3N3Ko
        include nats-1.1.2-1IJUekZt6ps5IWVCKMBPeK
        include reflection-2.1.8-7e35riv9i68DmU1dBKGfFR
        include semigroups-0.20-FifEs3zbUBKDT9bErGELTt
        include transformers-0.6.1.0
    component ad-4.5.6-JkDF2AMK3l65oR2Frifl7S-regression
        include ad-4.5.6-1WRJjsCnjTC4FZorB43KOi
        include base-4.18.2.1
        include tasty-1.4.3-GBUzr5T24qSDiUxn61W8Hz
        include tasty-hunit-0.10.1-B1ADdVA8ZkWIn4pNJBh2N9
Linked component graph:
    unit ad-4.5.6-1WRJjsCnjTC4FZorB43KOi
        include adjunctions-4.4.2-4iURKUgQrKS7atyO3QSdm7
        include array-0.5.6.0
        include base-4.18.2.1
        include comonad-5.0.8-25mhXRE9C8L1ZZaqNOc9vY
        include containers-0.6.7
        include data-reify-0.6.3-5pvj6HtNJh5K2KS7NgYUmS
        include erf-2.0.0.0-4xz1P35HuR5Dy4ovZUgjCU
        include free-5.2-JGEaoq8reB2HfhNMp3N3Ko
        include nats-1.1.2-1IJUekZt6ps5IWVCKMBPeK
        include reflection-2.1.8-7e35riv9i68DmU1dBKGfFR
        include semigroups-0.20-FifEs3zbUBKDT9bErGELTt
        include transformers-0.6.1.0
        Numeric.AD=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD,Numeric.AD.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Double,Numeric.AD.Halley.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Halley.Double,Numeric.AD.Internal.Dense=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Dense,Numeric.AD.Internal.Dense.Representable=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Dense.Representable,Numeric.AD.Internal.Doctest=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Doctest,Numeric.AD.Internal.Forward=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Forward,Numeric.AD.Internal.Forward.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Forward.Double,Numeric.AD.Internal.Identity=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Identity,Numeric.AD.Internal.Kahn=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Kahn,Numeric.AD.Internal.Kahn.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Kahn.Double,Numeric.AD.Internal.Kahn.Float=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Kahn.Float,Numeric.AD.Internal.On=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.On,Numeric.AD.Internal.Or=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Or,Numeric.AD.Internal.Reverse=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Reverse,Numeric.AD.Internal.Reverse.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Reverse.Double,Numeric.AD.Internal.Sparse=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Sparse,Numeric.AD.Internal.Sparse.Common=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Sparse.Common,Numeric.AD.Internal.Sparse.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Sparse.Double,Numeric.AD.Internal.Tower=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Tower,Numeric.AD.Internal.Tower.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Tower.Double,Numeric.AD.Internal.Type=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Internal.Type,Numeric.AD.Jacobian=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Jacobian,Numeric.AD.Jet=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Jet,Numeric.AD.Mode=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode,Numeric.AD.Mode.Dense=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Dense,Numeric.AD.Mode.Dense.Representable=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Dense.Representable,Numeric.AD.Mode.Forward=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Forward,Numeric.AD.Mode.Forward.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Forward.Double,Numeric.AD.Mode.Kahn=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Kahn,Numeric.AD.Mode.Kahn.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Kahn.Double,Numeric.AD.Mode.Reverse=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Reverse,Numeric.AD.Mode.Reverse.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Reverse.Double,Numeric.AD.Mode.Sparse=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Sparse,Numeric.AD.Mode.Sparse.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Sparse.Double,Numeric.AD.Mode.Tower=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Tower,Numeric.AD.Mode.Tower.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Mode.Tower.Double,Numeric.AD.Newton=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Newton,Numeric.AD.Newton.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Newton.Double,Numeric.AD.Rank1.Dense=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Dense,Numeric.AD.Rank1.Dense.Representable=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Dense.Representable,Numeric.AD.Rank1.Forward=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Forward,Numeric.AD.Rank1.Forward.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Forward.Double,Numeric.AD.Rank1.Halley=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Halley,Numeric.AD.Rank1.Halley.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Halley.Double,Numeric.AD.Rank1.Kahn=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Kahn,Numeric.AD.Rank1.Kahn.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Kahn.Double,Numeric.AD.Rank1.Kahn.Float=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Kahn.Float,Numeric.AD.Rank1.Newton=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Newton,Numeric.AD.Rank1.Newton.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Newton.Double,Numeric.AD.Rank1.Sparse=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Sparse,Numeric.AD.Rank1.Sparse.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Sparse.Double,Numeric.AD.Rank1.Tower=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Tower,Numeric.AD.Rank1.Tower.Double=ad-4.5.6-1WRJjsCnjTC4FZorB43KOi:Numeric.AD.Rank1.Tower.Double
    unit ad-4.5.6-JkDF2AMK3l65oR2Frifl7S-regression
        include ad-4.5.6-1WRJjsCnjTC4FZorB43KOi
        include base-4.18.2.1
        include tasty-1.4.3-GBUzr5T24qSDiUxn61W8Hz
        include tasty-hunit-0.10.1-B1ADdVA8ZkWIn4pNJBh2N9
Ready component graph:
    definite ad-4.5.6-1WRJjsCnjTC4FZorB43KOi
        depends adjunctions-4.4.2-4iURKUgQrKS7atyO3QSdm7
        depends array-0.5.6.0
        depends base-4.18.2.1
        depends comonad-5.0.8-25mhXRE9C8L1ZZaqNOc9vY
        depends containers-0.6.7
        depends data-reify-0.6.3-5pvj6HtNJh5K2KS7NgYUmS
        depends erf-2.0.0.0-4xz1P35HuR5Dy4ovZUgjCU
        depends free-5.2-JGEaoq8reB2HfhNMp3N3Ko
        depends nats-1.1.2-1IJUekZt6ps5IWVCKMBPeK
        depends reflection-2.1.8-7e35riv9i68DmU1dBKGfFR
        depends semigroups-0.20-FifEs3zbUBKDT9bErGELTt
        depends transformers-0.6.1.0
    definite ad-4.5.6-JkDF2AMK3l65oR2Frifl7S-regression
        depends ad-4.5.6-1WRJjsCnjTC4FZorB43KOi
        depends base-4.18.2.1
        depends tasty-1.4.3-GBUzr5T24qSDiUxn61W8Hz
        depends tasty-hunit-0.10.1-B1ADdVA8ZkWIn4pNJBh2N9
Using Cabal-3.10.3.0 compiled by ghc-9.6
Using compiler: ghc-9.6.5
Using install prefix: /nix/store/7pbzrd2r6ivdfjfnc0lsy36q1r59yp7q-ad-4.5.6
Executables installed in:
/nix/store/7pbzrd2r6ivdfjfnc0lsy36q1r59yp7q-ad-4.5.6/bin
Libraries installed in:
/nix/store/7pbzrd2r6ivdfjfnc0lsy36q1r59yp7q-ad-4.5.6/lib/ghc-9.6.5/lib/x86_64-osx-ghc-9.6.5/ad-4.5.6-1WRJjsCnjTC4FZorB43KOi
Dynamic Libraries installed in:
/nix/store/7pbzrd2r6ivdfjfnc0lsy36q1r59yp7q-ad-4.5.6/lib/ghc-9.6.5/lib/x86_64-osx-ghc-9.6.5
Private executables installed in:
/nix/store/7pbzrd2r6ivdfjfnc0lsy36q1r59yp7q-ad-4.5.6/libexec/x86_64-osx-ghc-9.6.5/ad-4.5.6
Data files installed in:
/nix/store/7pbzrd2r6ivdfjfnc0lsy36q1r59yp7q-ad-4.5.6/share/x86_64-osx-ghc-9.6.5/ad-4.5.6
Documentation installed in:
/nix/store/l7bxaac6am339ylrkf3wl7rhsgns91mi-ad-4.5.6-doc/share/doc/ad-4.5.6
Configuration files installed in:
/nix/store/7pbzrd2r6ivdfjfnc0lsy36q1r59yp7q-ad-4.5.6/etc
No alex found
Using ar found on system at:
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 16.0.6 given by user at:
/nix/store/zmfpybag2nwgyw932ahg36z8im955flp-clang-wrapper-16.0.6/bin/clang
Using ghc version 9.6.5 found on system at:
/nix/store/jw4wdi097y48kpwsyg9v4xrff0dzvd96-ghc-9.6.5/bin/ghc
Using ghc-pkg version 9.6.5 found on system at:
/nix/store/jw4wdi097y48kpwsyg9v4xrff0dzvd96-ghc-9.6.5/bin/ghc-pkg-9.6.5
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.29.2 found on system at:
/nix/store/jw4wdi097y48kpwsyg9v4xrff0dzvd96-ghc-9.6.5/bin/haddock-ghc-9.6.5
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.68 found on system at:
/nix/store/jw4wdi097y48kpwsyg9v4xrff0dzvd96-ghc-9.6.5/bin/hpc-ghc-9.6.5
Using hsc2hs version 0.68.9 found on system at:
/nix/store/jw4wdi097y48kpwsyg9v4xrff0dzvd96-ghc-9.6.5/bin/hsc2hs-ghc-9.6.5
Using hscolour version 1.25 found on system at:
/nix/store/9r8hfcgv474kbih9np6bzv32z8rhgc30-hscolour-1.25/bin/HsColour
No jhc found
Using ld found on system at:
/nix/store/hkliwgc5wirjdynkpx4ysgnb0gdhb3zf-cctools-binutils-darwin-wrapper-16.0.6-973.0.1/bin/ld
No pkg-config found
Using runghc version 9.6.5 found on system at:
/nix/store/jw4wdi097y48kpwsyg9v4xrff0dzvd96-ghc-9.6.5/bin/runghc-9.6.5
Using strip found on system at:
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/strip
Using tar found on system at:
/nix/store/a0dqk2q664ii86yiyjlid4bmn7iw1yyp-gnutar-1.35/bin/tar
No uhc found
Running phase: buildPhase
Preprocessing library for ad-4.5.6..
Building library for ad-4.5.6..
[ 1 of 55] Compiling Numeric.AD.Internal.Doctest ( src/Numeric/AD/Internal/Doctest.hs, dist/build/Numeric/AD/Internal/Doctest.o, dist/build/Numeric/AD/Internal/Doctest.dyn_o )
[ 2 of 55] Compiling Numeric.AD.Internal.Sparse.Common ( src/Numeric/AD/Internal/Sparse/Common.hs, dist/build/Numeric/AD/Internal/Sparse/Common.o, dist/build/Numeric/AD/Internal/Sparse/Common.dyn_o )
[ 3 of 55] Compiling Numeric.AD.Jet   ( src/Numeric/AD/Jet.hs, dist/build/Numeric/AD/Jet.o, dist/build/Numeric/AD/Jet.dyn_o )
[ 4 of 55] Compiling Numeric.AD.Mode  ( src/Numeric/AD/Mode.hs, dist/build/Numeric/AD/Mode.o, dist/build/Numeric/AD/Mode.dyn_o )
[ 5 of 55] Compiling Numeric.AD.Jacobian ( src/Numeric/AD/Jacobian.hs, dist/build/Numeric/AD/Jacobian.o, dist/build/Numeric/AD/Jacobian.dyn_o )
[ 6 of 55] Compiling Numeric.AD.Internal.Type ( src/Numeric/AD/Internal/Type.hs, dist/build/Numeric/AD/Internal/Type.o, dist/build/Numeric/AD/Internal/Type.dyn_o )
[ 7 of 55] Compiling Numeric.AD.Internal.Or ( src/Numeric/AD/Internal/Or.hs, dist/build/Numeric/AD/Internal/Or.o, dist/build/Numeric/AD/Internal/Or.dyn_o )
[ 8 of 55] Compiling Numeric.AD.Internal.On ( src/Numeric/AD/Internal/On.hs, dist/build/Numeric/AD/Internal/On.o, dist/build/Numeric/AD/Internal/On.dyn_o )
[ 9 of 55] Compiling Numeric.AD.Internal.Identity ( src/Numeric/AD/Internal/Identity.hs, dist/build/Numeric/AD/Internal/Identity.o, dist/build/Numeric/AD/Internal/Identity.dyn_o )
[10 of 55] Compiling Numeric.AD.Internal.Combinators ( src/Numeric/AD/Internal/Combinators.hs, dist/build/Numeric/AD/Internal/Combinators.o, dist/build/Numeric/AD/Internal/Combinators.dyn_o )
[11 of 55] Compiling Numeric.AD.Internal.Tower.Double ( src/Numeric/AD/Internal/Tower/Double.hs, dist/build/Numeric/AD/Internal/Tower/Double.o, dist/build/Numeric/AD/Internal/Tower/Double.dyn_o )
[12 of 55] Compiling Numeric.AD.Internal.Tower ( src/Numeric/AD/Internal/Tower.hs, dist/build/Numeric/AD/Internal/Tower.o, dist/build/Numeric/AD/Internal/Tower.dyn_o )
[13 of 55] Compiling Numeric.AD.Internal.Sparse.Double ( src/Numeric/AD/Internal/Sparse/Double.hs, dist/build/Numeric/AD/Internal/Sparse/Double.o, dist/build/Numeric/AD/Internal/Sparse/Double.dyn_o )
[14 of 55] Compiling Numeric.AD.Internal.Sparse ( src/Numeric/AD/Internal/Sparse.hs, dist/build/Numeric/AD/Internal/Sparse.o, dist/build/Numeric/AD/Internal/Sparse.dyn_o )
[15 of 55] Compiling Numeric.AD.Internal.Reverse.Double ( src/Numeric/AD/Internal/Reverse/Double.hs, dist/build/Numeric/AD/Internal/Reverse/Double.o, dist/build/Numeric/AD/Internal/Reverse/Double.dyn_o )
[16 of 55] Compiling Numeric.AD.Internal.Reverse ( src/Numeric/AD/Internal/Reverse.hs, dist/build/Numeric/AD/Internal/Reverse.o, dist/build/Numeric/AD/Internal/Reverse.dyn_o )
[17 of 55] Compiling Numeric.AD.Internal.Kahn.Float ( src/Numeric/AD/Internal/Kahn/Float.hs, dist/build/Numeric/AD/Internal/Kahn/Float.o, dist/build/Numeric/AD/Internal/Kahn/Float.dyn_o )
[18 of 55] Compiling Numeric.AD.Internal.Kahn.Double ( src/Numeric/AD/Internal/Kahn/Double.hs, dist/build/Numeric/AD/Internal/Kahn/Double.o, dist/build/Numeric/AD/Internal/Kahn/Double.dyn_o )
[19 of 55] Compiling Numeric.AD.Internal.Kahn ( src/Numeric/AD/Internal/Kahn.hs, dist/build/Numeric/AD/Internal/Kahn.o, dist/build/Numeric/AD/Internal/Kahn.dyn_o )
[20 of 55] Compiling Numeric.AD.Internal.Forward.Double ( src/Numeric/AD/Internal/Forward/Double.hs, dist/build/Numeric/AD/Internal/Forward/Double.o, dist/build/Numeric/AD/Internal/Forward/Double.dyn_o )
[21 of 55] Compiling Numeric.AD.Internal.Forward ( src/Numeric/AD/Internal/Forward.hs, dist/build/Numeric/AD/Internal/Forward.o, dist/build/Numeric/AD/Internal/Forward.dyn_o )
[22 of 55] Compiling Numeric.AD.Internal.Dense.Representable ( src/Numeric/AD/Internal/Dense/Representable.hs, dist/build/Numeric/AD/Internal/Dense/Representable.o, dist/build/Numeric/AD/Internal/Dense/Representable.dyn_o )
[23 of 55] Compiling Numeric.AD.Internal.Dense ( src/Numeric/AD/Internal/Dense.hs, dist/build/Numeric/AD/Internal/Dense.o, dist/build/Numeric/AD/Internal/Dense.dyn_o )
[24 of 55] Compiling Numeric.AD.Mode.Reverse ( src/Numeric/AD/Mode/Reverse.hs, dist/build/Numeric/AD/Mode/Reverse.o, dist/build/Numeric/AD/Mode/Reverse.dyn_o )
[25 of 55] Compiling Numeric.AD.Mode.Reverse.Double ( src/Numeric/AD/Mode/Reverse/Double.hs, dist/build/Numeric/AD/Mode/Reverse/Double.o, dist/build/Numeric/AD/Mode/Reverse/Double.dyn_o )
[26 of 55] Compiling Numeric.AD.Rank1.Dense ( src/Numeric/AD/Rank1/Dense.hs, dist/build/Numeric/AD/Rank1/Dense.o, dist/build/Numeric/AD/Rank1/Dense.dyn_o )
[27 of 55] Compiling Numeric.AD.Mode.Dense ( src/Numeric/AD/Mode/Dense.hs, dist/build/Numeric/AD/Mode/Dense.o, dist/build/Numeric/AD/Mode/Dense.dyn_o )
[28 of 55] Compiling Numeric.AD.Rank1.Dense.Representable ( src/Numeric/AD/Rank1/Dense/Representable.hs, dist/build/Numeric/AD/Rank1/Dense/Representable.o, dist/build/Numeric/AD/Rank1/Dense/Representable.dyn_o )
[29 of 55] Compiling Numeric.AD.Mode.Dense.Representable ( src/Numeric/AD/Mode/Dense/Representable.hs, dist/build/Numeric/AD/Mode/Dense/Representable.o, dist/build/Numeric/AD/Mode/Dense/Representable.dyn_o )
[30 of 55] Compiling Numeric.AD.Rank1.Forward ( src/Numeric/AD/Rank1/Forward.hs, dist/build/Numeric/AD/Rank1/Forward.o, dist/build/Numeric/AD/Rank1/Forward.dyn_o )
[31 of 55] Compiling Numeric.AD.Mode.Forward ( src/Numeric/AD/Mode/Forward.hs, dist/build/Numeric/AD/Mode/Forward.o, dist/build/Numeric/AD/Mode/Forward.dyn_o )
[32 of 55] Compiling Numeric.AD.Rank1.Forward.Double ( src/Numeric/AD/Rank1/Forward/Double.hs, dist/build/Numeric/AD/Rank1/Forward/Double.o, dist/build/Numeric/AD/Rank1/Forward/Double.dyn_o )
[33 of 55] Compiling Numeric.AD.Mode.Forward.Double ( src/Numeric/AD/Mode/Forward/Double.hs, dist/build/Numeric/AD/Mode/Forward/Double.o, dist/build/Numeric/AD/Mode/Forward/Double.dyn_o )
[34 of 55] Compiling Numeric.AD.Rank1.Kahn ( src/Numeric/AD/Rank1/Kahn.hs, dist/build/Numeric/AD/Rank1/Kahn.o, dist/build/Numeric/AD/Rank1/Kahn.dyn_o )
[35 of 55] Compiling Numeric.AD.Mode.Kahn ( src/Numeric/AD/Mode/Kahn.hs, dist/build/Numeric/AD/Mode/Kahn.o, dist/build/Numeric/AD/Mode/Kahn.dyn_o )
[36 of 55] Compiling Numeric.AD.Rank1.Kahn.Double ( src/Numeric/AD/Rank1/Kahn/Double.hs, dist/build/Numeric/AD/Rank1/Kahn/Double.o, dist/build/Numeric/AD/Rank1/Kahn/Double.dyn_o )
[37 of 55] Compiling Numeric.AD.Mode.Kahn.Double ( src/Numeric/AD/Mode/Kahn/Double.hs, dist/build/Numeric/AD/Mode/Kahn/Double.o, dist/build/Numeric/AD/Mode/Kahn/Double.dyn_o )
[38 of 55] Compiling Numeric.AD.Rank1.Kahn.Float ( src/Numeric/AD/Rank1/Kahn/Float.hs, dist/build/Numeric/AD/Rank1/Kahn/Float.o, dist/build/Numeric/AD/Rank1/Kahn/Float.dyn_o )
[39 of 55] Compiling Numeric.AD.Rank1.Newton ( src/Numeric/AD/Rank1/Newton.hs, dist/build/Numeric/AD/Rank1/Newton.o, dist/build/Numeric/AD/Rank1/Newton.dyn_o )
[40 of 55] Compiling Numeric.AD.Newton ( src/Numeric/AD/Newton.hs, dist/build/Numeric/AD/Newton.o, dist/build/Numeric/AD/Newton.dyn_o )
[41 of 55] Compiling Numeric.AD.Rank1.Newton.Double ( src/Numeric/AD/Rank1/Newton/Double.hs, dist/build/Numeric/AD/Rank1/Newton/Double.o, dist/build/Numeric/AD/Rank1/Newton/Double.dyn_o )
[42 of 55] Compiling Numeric.AD.Newton.Double ( src/Numeric/AD/Newton/Double.hs, dist/build/Numeric/AD/Newton/Double.o, dist/build/Numeric/AD/Newton/Double.dyn_o )
[43 of 55] Compiling Numeric.AD.Rank1.Sparse ( src/Numeric/AD/Rank1/Sparse.hs, dist/build/Numeric/AD/Rank1/Sparse.o, dist/build/Numeric/AD/Rank1/Sparse.dyn_o )
[44 of 55] Compiling Numeric.AD.Mode.Sparse ( src/Numeric/AD/Mode/Sparse.hs, dist/build/Numeric/AD/Mode/Sparse.o, dist/build/Numeric/AD/Mode/Sparse.dyn_o )
[45 of 55] Compiling Numeric.AD.Rank1.Sparse.Double ( src/Numeric/AD/Rank1/Sparse/Double.hs, dist/build/Numeric/AD/Rank1/Sparse/Double.o, dist/build/Numeric/AD/Rank1/Sparse/Double.dyn_o )
[46 of 55] Compiling Numeric.AD.Mode.Sparse.Double ( src/Numeric/AD/Mode/Sparse/Double.hs, dist/build/Numeric/AD/Mode/Sparse/Double.o, dist/build/Numeric/AD/Mode/Sparse/Double.dyn_o )
[47 of 55] Compiling Numeric.AD.Rank1.Tower ( src/Numeric/AD/Rank1/Tower.hs, dist/build/Numeric/AD/Rank1/Tower.o, dist/build/Numeric/AD/Rank1/Tower.dyn_o )
[48 of 55] Compiling Numeric.AD.Rank1.Halley ( src/Numeric/AD/Rank1/Halley.hs, dist/build/Numeric/AD/Rank1/Halley.o, dist/build/Numeric/AD/Rank1/Halley.dyn_o )
[49 of 55] Compiling Numeric.AD.Mode.Tower ( src/Numeric/AD/Mode/Tower.hs, dist/build/Numeric/AD/Mode/Tower.o, dist/build/Numeric/AD/Mode/Tower.dyn_o )
[50 of 55] Compiling Numeric.AD       ( src/Numeric/AD.hs, dist/build/Numeric/AD.o, dist/build/Numeric/AD.dyn_o )
[51 of 55] Compiling Numeric.AD.Rank1.Tower.Double ( src/Numeric/AD/Rank1/Tower/Double.hs, dist/build/Numeric/AD/Rank1/Tower/Double.o, dist/build/Numeric/AD/Rank1/Tower/Double.dyn_o )
[52 of 55] Compiling Numeric.AD.Rank1.Halley.Double ( src/Numeric/AD/Rank1/Halley/Double.hs, dist/build/Numeric/AD/Rank1/Halley/Double.o, dist/build/Numeric/AD/Rank1/Halley/Double.dyn_o )
[53 of 55] Compiling Numeric.AD.Halley.Double ( src/Numeric/AD/Halley/Double.hs, dist/build/Numeric/AD/Halley/Double.o, dist/build/Numeric/AD/Halley/Double.dyn_o )
[54 of 55] Compiling Numeric.AD.Mode.Tower.Double ( src/Numeric/AD/Mode/Tower/Double.hs, dist/build/Numeric/AD/Mode/Tower/Double.o, dist/build/Numeric/AD/Mode/Tower/Double.dyn_o )
[55 of 55] Compiling Numeric.AD.Double ( src/Numeric/AD/Double.hs, dist/build/Numeric/AD/Double.o, dist/build/Numeric/AD/Double.dyn_o )
[ 1 of 55] Compiling Numeric.AD.Internal.Doctest ( src/Numeric/AD/Internal/Doctest.hs, dist/build/Numeric/AD/Internal/Doctest.p_o )
[ 2 of 55] Compiling Numeric.AD.Internal.Sparse.Common ( src/Numeric/AD/Internal/Sparse/Common.hs, dist/build/Numeric/AD/Internal/Sparse/Common.p_o )
[ 3 of 55] Compiling Numeric.AD.Jet   ( src/Numeric/AD/Jet.hs, dist/build/Numeric/AD/Jet.p_o )
[ 4 of 55] Compiling Numeric.AD.Mode  ( src/Numeric/AD/Mode.hs, dist/build/Numeric/AD/Mode.p_o )
[ 5 of 55] Compiling Numeric.AD.Jacobian ( src/Numeric/AD/Jacobian.hs, dist/build/Numeric/AD/Jacobian.p_o )
[ 6 of 55] Compiling Numeric.AD.Internal.Type ( src/Numeric/AD/Internal/Type.hs, dist/build/Numeric/AD/Internal/Type.p_o )
[ 7 of 55] Compiling Numeric.AD.Internal.Or ( src/Numeric/AD/Internal/Or.hs, dist/build/Numeric/AD/Internal/Or.p_o )
[ 8 of 55] Compiling Numeric.AD.Internal.On ( src/Numeric/AD/Internal/On.hs, dist/build/Numeric/AD/Internal/On.p_o )
[ 9 of 55] Compiling Numeric.AD.Internal.Identity ( src/Numeric/AD/Internal/Identity.hs, dist/build/Numeric/AD/Internal/Identity.p_o )
[10 of 55] Compiling Numeric.AD.Internal.Combinators ( src/Numeric/AD/Internal/Combinators.hs, dist/build/Numeric/AD/Internal/Combinators.p_o )
[11 of 55] Compiling Numeric.AD.Internal.Tower.Double ( src/Numeric/AD/Internal/Tower/Double.hs, dist/build/Numeric/AD/Internal/Tower/Double.p_o )
[12 of 55] Compiling Numeric.AD.Internal.Tower ( src/Numeric/AD/Internal/Tower.hs, dist/build/Numeric/AD/Internal/Tower.p_o )
[13 of 55] Compiling Numeric.AD.Internal.Sparse.Double ( src/Numeric/AD/Internal/Sparse/Double.hs, dist/build/Numeric/AD/Internal/Sparse/Double.p_o )
[14 of 55] Compiling Numeric.AD.Internal.Sparse ( src/Numeric/AD/Internal/Sparse.hs, dist/build/Numeric/AD/Internal/Sparse.p_o )
[15 of 55] Compiling Numeric.AD.Internal.Reverse.Double ( src/Numeric/AD/Internal/Reverse/Double.hs, dist/build/Numeric/AD/Internal/Reverse/Double.p_o )
[16 of 55] Compiling Numeric.AD.Internal.Reverse ( src/Numeric/AD/Internal/Reverse.hs, dist/build/Numeric/AD/Internal/Reverse.p_o )
[17 of 55] Compiling Numeric.AD.Internal.Kahn.Float ( src/Numeric/AD/Internal/Kahn/Float.hs, dist/build/Numeric/AD/Internal/Kahn/Float.p_o )
[18 of 55] Compiling Numeric.AD.Internal.Kahn.Double ( src/Numeric/AD/Internal/Kahn/Double.hs, dist/build/Numeric/AD/Internal/Kahn/Double.p_o )
[19 of 55] Compiling Numeric.AD.Internal.Kahn ( src/Numeric/AD/Internal/Kahn.hs, dist/build/Numeric/AD/Internal/Kahn.p_o )
[20 of 55] Compiling Numeric.AD.Internal.Forward.Double ( src/Numeric/AD/Internal/Forward/Double.hs, dist/build/Numeric/AD/Internal/Forward/Double.p_o )
[21 of 55] Compiling Numeric.AD.Internal.Forward ( src/Numeric/AD/Internal/Forward.hs, dist/build/Numeric/AD/Internal/Forward.p_o )
[22 of 55] Compiling Numeric.AD.Internal.Dense.Representable ( src/Numeric/AD/Internal/Dense/Representable.hs, dist/build/Numeric/AD/Internal/Dense/Representable.p_o )
[23 of 55] Compiling Numeric.AD.Internal.Dense ( src/Numeric/AD/Internal/Dense.hs, dist/build/Numeric/AD/Internal/Dense.p_o )
[24 of 55] Compiling Numeric.AD.Mode.Reverse ( src/Numeric/AD/Mode/Reverse.hs, dist/build/Numeric/AD/Mode/Reverse.p_o )
[25 of 55] Compiling Numeric.AD.Mode.Reverse.Double ( src/Numeric/AD/Mode/Reverse/Double.hs, dist/build/Numeric/AD/Mode/Reverse/Double.p_o )
[26 of 55] Compiling Numeric.AD.Rank1.Dense ( src/Numeric/AD/Rank1/Dense.hs, dist/build/Numeric/AD/Rank1/Dense.p_o )
[27 of 55] Compiling Numeric.AD.Mode.Dense ( src/Numeric/AD/Mode/Dense.hs, dist/build/Numeric/AD/Mode/Dense.p_o )
[28 of 55] Compiling Numeric.AD.Rank1.Dense.Representable ( src/Numeric/AD/Rank1/Dense/Representable.hs, dist/build/Numeric/AD/Rank1/Dense/Representable.p_o )
[29 of 55] Compiling Numeric.AD.Mode.Dense.Representable ( src/Numeric/AD/Mode/Dense/Representable.hs, dist/build/Numeric/AD/Mode/Dense/Representable.p_o )
[30 of 55] Compiling Numeric.AD.Rank1.Forward ( src/Numeric/AD/Rank1/Forward.hs, dist/build/Numeric/AD/Rank1/Forward.p_o )
[31 of 55] Compiling Numeric.AD.Mode.Forward ( src/Numeric/AD/Mode/Forward.hs, dist/build/Numeric/AD/Mode/Forward.p_o )
[32 of 55] Compiling Numeric.AD.Rank1.Forward.Double ( src/Numeric/AD/Rank1/Forward/Double.hs, dist/build/Numeric/AD/Rank1/Forward/Double.p_o )
[33 of 55] Compiling Numeric.AD.Mode.Forward.Double ( src/Numeric/AD/Mode/Forward/Double.hs, dist/build/Numeric/AD/Mode/Forward/Double.p_o )
[34 of 55] Compiling Numeric.AD.Rank1.Kahn ( src/Numeric/AD/Rank1/Kahn.hs, dist/build/Numeric/AD/Rank1/Kahn.p_o )
[35 of 55] Compiling Numeric.AD.Mode.Kahn ( src/Numeric/AD/Mode/Kahn.hs, dist/build/Numeric/AD/Mode/Kahn.p_o )
[36 of 55] Compiling Numeric.AD.Rank1.Kahn.Double ( src/Numeric/AD/Rank1/Kahn/Double.hs, dist/build/Numeric/AD/Rank1/Kahn/Double.p_o )
[37 of 55] Compiling Numeric.AD.Mode.Kahn.Double ( src/Numeric/AD/Mode/Kahn/Double.hs, dist/build/Numeric/AD/Mode/Kahn/Double.p_o )
[38 of 55] Compiling Numeric.AD.Rank1.Kahn.Float ( src/Numeric/AD/Rank1/Kahn/Float.hs, dist/build/Numeric/AD/Rank1/Kahn/Float.p_o )
[39 of 55] Compiling Numeric.AD.Rank1.Newton ( src/Numeric/AD/Rank1/Newton.hs, dist/build/Numeric/AD/Rank1/Newton.p_o )
[40 of 55] Compiling Numeric.AD.Newton ( src/Numeric/AD/Newton.hs, dist/build/Numeric/AD/Newton.p_o )
[41 of 55] Compiling Numeric.AD.Rank1.Newton.Double ( src/Numeric/AD/Rank1/Newton/Double.hs, dist/build/Numeric/AD/Rank1/Newton/Double.p_o )
[42 of 55] Compiling Numeric.AD.Newton.Double ( src/Numeric/AD/Newton/Double.hs, dist/build/Numeric/AD/Newton/Double.p_o )
[43 of 55] Compiling Numeric.AD.Rank1.Sparse ( src/Numeric/AD/Rank1/Sparse.hs, dist/build/Numeric/AD/Rank1/Sparse.p_o )
[44 of 55] Compiling Numeric.AD.Mode.Sparse ( src/Numeric/AD/Mode/Sparse.hs, dist/build/Numeric/AD/Mode/Sparse.p_o )
[45 of 55] Compiling Numeric.AD.Rank1.Sparse.Double ( src/Numeric/AD/Rank1/Sparse/Double.hs, dist/build/Numeric/AD/Rank1/Sparse/Double.p_o )
[46 of 55] Compiling Numeric.AD.Mode.Sparse.Double ( src/Numeric/AD/Mode/Sparse/Double.hs, dist/build/Numeric/AD/Mode/Sparse/Double.p_o )
[47 of 55] Compiling Numeric.AD.Rank1.Tower ( src/Numeric/AD/Rank1/Tower.hs, dist/build/Numeric/AD/Rank1/Tower.p_o )
[48 of 55] Compiling Numeric.AD.Rank1.Halley ( src/Numeric/AD/Rank1/Halley.hs, dist/build/Numeric/AD/Rank1/Halley.p_o )
[49 of 55] Compiling Numeric.AD.Mode.Tower ( src/Numeric/AD/Mode/Tower.hs, dist/build/Numeric/AD/Mode/Tower.p_o )
[50 of 55] Compiling Numeric.AD       ( src/Numeric/AD.hs, dist/build/Numeric/AD.p_o )
[51 of 55] Compiling Numeric.AD.Rank1.Tower.Double ( src/Numeric/AD/Rank1/Tower/Double.hs, dist/build/Numeric/AD/Rank1/Tower/Double.p_o )
[52 of 55] Compiling Numeric.AD.Rank1.Halley.Double ( src/Numeric/AD/Rank1/Halley/Double.hs, dist/build/Numeric/AD/Rank1/Halley/Double.p_o )
[53 of 55] Compiling Numeric.AD.Halley.Double ( src/Numeric/AD/Halley/Double.hs, dist/build/Numeric/AD/Halley/Double.p_o )
[54 of 55] Compiling Numeric.AD.Mode.Tower.Double ( src/Numeric/AD/Mode/Tower/Double.hs, dist/build/Numeric/AD/Mode/Tower/Double.p_o )
[55 of 55] Compiling Numeric.AD.Double ( src/Numeric/AD/Double.hs, dist/build/Numeric/AD/Double.p_o )
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(longlong.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(Disassembler.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(LdvProfile.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(OldARMAtomic.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(ProfilerReport.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(ProfilerReportJson.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(Profiling.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(RetainerProfile.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(RetainerSet.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(RtsDllMain.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(SpinLock.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(TraverseHeap.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(TraverseHeapTest.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(TSANUtils.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(Elf.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(plt.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(plt_aarch64.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(PEi386.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(elf_got.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(elf_plt.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(elf_plt_aarch64.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(elf_plt_arm.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(elf_reloc.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(elf_reloc_aarch64.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(elf_tlsgd.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(elf_util.o) has no symbols
/nix/store/qlr78286k6ly3vw8yzxfh4ycagw7krd2-cctools-binutils-darwin-16.0.6-973.0.1/bin/ranlib: file: dist/build/libHSad-4.5.6-1WRJjsCnjTC4FZorB43KOi-ghc9.6.5.a(Sanity.o) has no symbols
Preprocessing test suite 'regression' for ad-4.5.6..
Building test suite 'regression' for ad-4.5.6..
[1 of 1] Compiling Main             ( tests/Regression.hs, dist/build/regression/regression-tmp/Main.o )
[2 of 2] Linking dist/build/regression/regression
buildPhase completed in 1 minutes 48 seconds
Running phase: checkPhase
Running 1 test suites...
Test suite regression: RUNNING...
tests
  forward
    basic
      diff:     OK
      grad:     OK
      jacobian: OK
      hessian:  OK
    issue-97:   OK
    issue-104
      inside
        diff:   OK
        grad:   OK
      outside
        diff:   OK
        grad:   OK
    issue-108
      log1p:    OK
      expm1:    FAIL
        tests/Regression.hs:140:
        expected (1.718281828459045,2.718281828459045) but got (1.7182818284590453,2.718281828459045)
        Use -p '/forward.issue-108.expm1/' to rerun this test only.
      log1pexp: OK
      log1mexp: FAIL
        tests/Regression.hs:140:
        expected (-0.45867514538708193,-0.5819767068693265) but got (-0.45867514538708193,-0.5819767068693263)
        Use -p '/forward.issue-108.log1mexp/' to rerun this test only.
  reverse
    basic
      diff:     OK
      grad:     OK
      jacobian: OK
      hessian:  OK
    issue-97:   OK
    issue-104
      inside
        diff:   OK
        grad:   OK
      outside
        diff:   OK
        grad:   OK
    issue-108
      log1p:    OK
      expm1:    FAIL
        tests/Regression.hs:140:
        expected (1.718281828459045,2.718281828459045) but got (1.7182818284590453,2.718281828459045)
        Use -p '/reverse.issue-108.expm1/' to rerun this test only.
      log1pexp: OK
      log1mexp: FAIL
        tests/Regression.hs:140:
        expected (-0.45867514538708193,-0.5819767068693265) but got (-0.45867514538708193,-0.5819767068693263)
        Use -p '/reverse.issue-108.log1mexp/' to rerun this test only.
  reverse-double
    basic
      diff:     OK
      grad:     OK
      jacobian: OK
      hessian:  OK
    issue-97:   OK
    issue-104
      inside
        diff:   OK
        grad:   OK
      outside
        diff:   OK
        grad:   OK
    issue-108
      log1p:    OK
      expm1:    FAIL
        tests/Regression.hs:140:
        expected (1.718281828459045,2.718281828459045) but got (1.7182818284590453,2.718281828459045)
        Use -p '/reverse-double.issue-108.expm1/' to rerun this test only.
      log1pexp: OK
      log1mexp: FAIL
        tests/Regression.hs:140:
        expected (-0.45867514538708193,-0.5819767068693265) but got (-0.45867514538708193,-0.5819767068693263)
        Use -p '/reverse-double.issue-108.log1mexp/' to rerun this test only.

6 out of 39 tests failed (0.00s)
Test suite regression: FAIL
Test suite logged to: dist/test/ad-4.5.6-regression.log
0 of 1 test suites (0 of 1 test cases) passed.

Any ideas?

@RyanGlScott
Copy link
Collaborator

Good catch. I wonder if we should be defining eq like this instead?

diff --git a/tests/Regression.hs b/tests/Regression.hs
index b03266e..d212daa 100644
--- a/tests/Regression.hs
+++ b/tests/Regression.hs
@@ -143,7 +143,12 @@ issue108 diff = testGroup "issue-108" [tlog1p, texpm1, tlog1pexp, tlog1mexp] whe
 --       however, zero signedness is currently not reliably propagated through some modes
 --       see also https://github.com/ekmett/ad/issues/109 and https://github.com/ekmett/ad/pull/110
 eq :: Double -> Double -> Bool
-eq a b = isNaN a && isNaN b || a == b
+eq a b = isNaN a && isNaN b ||
+         signum a == signum b && isInfinite a && isInfinite b ||
+         nearZero (a - b)
+
+nearZero :: Double -> Bool
+nearZero a = abs a <= 1e-12
 
 list :: (a -> a -> Bool) -> [a] -> [a] -> Bool
 list eq as bs = length as == length bs && and (zipWith eq as bs)

Thoughts, @julmb?

@cartazio
Copy link
Collaborator

cartazio commented May 28, 2024 via email

@julmb
Copy link
Contributor Author

julmb commented May 29, 2024

I've experienced the regression tests introduced here failing reliably, but only on x86_64-darwin (not aarch64-darwin, aarch64-linux, x86_64-linux). Sample Log:

Ah, that is very annoying. I wonder what x86_64-darwin is doing differently...

Good catch. I wonder if we should be defining eq like this instead?

diff --git a/tests/Regression.hs b/tests/Regression.hs
index b03266e..d212daa 100644
--- a/tests/Regression.hs
+++ b/tests/Regression.hs
@@ -143,7 +143,12 @@ issue108 diff = testGroup "issue-108" [tlog1p, texpm1, tlog1pexp, tlog1mexp] whe
 --       however, zero signedness is currently not reliably propagated through some modes
 --       see also https://github.com/ekmett/ad/issues/109 and https://github.com/ekmett/ad/pull/110
 eq :: Double -> Double -> Bool
-eq a b = isNaN a && isNaN b || a == b
+eq a b = isNaN a && isNaN b ||
+         signum a == signum b && isInfinite a && isInfinite b ||
+         nearZero (a - b)
+
+nearZero :: Double -> Bool
+nearZero a = abs a <= 1e-12
 
 list :: (a -> a -> Bool) -> [a] -> [a] -> Bool
 list eq as bs = length as == length bs && and (zipWith eq as bs)

Thoughts, @julmb?

This is how equality used to be handled in the tests before #110. However, in this PR we have cases like these:

Expression Faulty Result Correct Result
log1p 1e-20 0 1e-20
expm1 1e-15 1.1102230246251565e-15 1.0000000000000007e-15
log1pexp (-100) 0 3.720075976020836e-44

So, while abs a <= 1e-12 would avoid the false positives on the x86_64-darwin platform, it would not be able to distinguish faulty and correct outcomes in the cases above, thereby potentially causing regressions to go undetected.

We probably want to measure relative error instead of absolute error, but then extra care has to be taken when the expected result is zero. In that case, we probably want to force the actual result to also be exactly zero.

@RyanGlScott
Copy link
Collaborator

We probably want to measure relative error instead of absolute error, but then extra care has to be taken when the expected result is zero.

OK. Are you willing to submit a PR which updates the test suite to use relative error?

@julmb
Copy link
Contributor Author

julmb commented May 30, 2024

I don't know when I'll have the chance to do it, but I'll try and make one in the next couple of days.

@RyanGlScott
Copy link
Collaborator

Thanks, @julmb! I've split this off into a separate issue in #113.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants