Comments (6)
I get the same result on NixOS, so it's probably just how glibc is implemented. I also get that result in the Futhark interpreter, which uses Haskell's pow
(but which is probably implemented via the C library). macOS uses a C library developed as part of the LLVM project. I have no reason to know which is more accurate.
Anyway, Futhark intentionally doesn't implement any of these numerical primitives itself, but just dispatches to whatever the platform does. That is overall a good idea, but sometimes this leads to small inconsistencies. You'll see even larger differences once you start running this on GPUs - they really push the allowable bounds on accuracy.
I'll close the issue as I don't think Futhark is doing anything wrong.
from futhark.
Are you sure it's a discrepancy in **
and not the other operations (which I guess would have to be the square root)? In any case, Futhark compiles those to pow
in the platform C library, which I suppose can vary between platforms.
from futhark.
I would have to assume its in **
as that is the only difference in calculations between xyf2
and xyf2SQ
from futhark.
What happens if you say xi*xi+yi*yi
instead of xi**2+yi**2
, and use f64.sqrt
instead of **0.5
?
from futhark.
I really think it's just a tiny variance in the precision of pow()
across different implementation (and I don't know which one is most accurate). Computing
map(\(xi,yi) -> ((xi**2+yi**2)**0.5-((0.5 + tol2)*diameter))) (zip x y)
I see some numbers very close to zero, and it wouldn't take much nudging to push them over the line.
from futhark.
I suspect you're correct in that. When testing your request, I see consistency with the other sets that seem to match. It appears that the failure case (the inconsistency with xf2) is an accumulated error/inconsistency in pow() in ubuntu 22.04
(venv) zerbeba1@TALOS:~/futhark-tracer/examples$ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
from futhark.
Related Issues (20)
- Size-type error after pass `simplify` HOT 1
- Futhark does not run with GHC 9.8 HOT 2
- Internal compiler error: unknown variable HOT 1
- ispc backend failing on large ranges HOT 8
- Document `FUTHARK_COMPILER_DEBUGGING=2`.
- Limit context memory use HOT 4
- Internal compiler error
- Internal compiler error (unhandled IO exception).
- Dead repl link on front page HOT 1
- Justification for Alias Tracking HOT 1
- futhark c and multicore are giving different results HOT 3
- Module ascription does not type check
- Is it possible to add a compiled version of the windows version available for download? HOT 4
- Documentation improvement for Prelude math functions HOT 3
- Type suffixes should be ignored when unifying expressions
- Spurious variance in tensor contraction expression going into loop tiling HOT 10
- OpenCL and Macbook M1 pro - Program that uses builint hist fails to run HOT 1
- Monomorphisation does not variable-ize size expressions properly
- `futhark bench --skip-compilation` with non-server executable hangs indefinitely HOT 2
- Type checker does not detect size mismatch in loop HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from futhark.