Skip to content

Commit 147fbff

Browse files
committed
Fix flake for darwin, approxWith factorial.
1 parent adf4529 commit 147fbff

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎flake.nix‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
ps.shellFor {
199199
packages = ps: if hasArrayfire then [ ps.arrayfire ] else [ ];
200200
withHoogle = true;
201-
buildInputs = with pkgs; (if isLinux then [ ocl-icd ] else [ darwin.apple_sdk.frameworks.Security ]);
201+
buildInputs = with pkgs; (if isLinux then [ ocl-icd ] else [ ]);
202202
nativeBuildInputs = with pkgs; with ps; [
203203
# Building and testing
204204
cabal-install

‎test/ArrayFire/ArithSpec.hs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,11 @@ spec =
273273
it "factorial 5 = 120" $
274274
evalf (ArrayFire.factorial (scalar @Double 5)) `shouldBeApprox` 120
275275
it "factorial 10 = 3628800" $
276-
evalf (ArrayFire.factorial (scalar @Double 10)) `shouldBeApprox` 3628800
276+
-- factorial is computed via the platform libm gamma function, which is
277+
-- not bit-exact: on macOS it lands ~2.3e-9 off, exceeding the default
278+
-- relative tolerance (~1.6e-9 at this magnitude). Loosen it here.
279+
approxWith 1e-7 1e-7 (evalf (ArrayFire.factorial (scalar @Double 10))) 3628800
280+
`shouldBe` True
277281

278282
describe "floor" $ do
279283
it "floor of 1.7 is 1" $

0 commit comments

Comments
 (0)