Comments (4)
I'm far from an expert on these things, having only really discovered this by a similar accident, but as I understand it rounding modes typically are only correct for basic arithmetic operation (and sqrt). There is CRlibm, which claims to be much more accurate for these cases, but even then at some point you still suffer from the table-maker's dilemma for any operation involving transcendental numbers.
This should be documented though.
from openlibm.
Or alternatively, we could save and restore the rounding mode, doing the actual computation in round-to-nearest, which I understand is what glibc does.
from openlibm.
I think that saving and restoring is probably the best approach. The main use case for changing rounding modes is verifying algorithm stability, which doesn't really work if our libm functions return garbage – testing their algorithm stability is not the point – they are one of the few things in the system that we actually know are really stable across the full range of values. The real trick is going back to default rounding in libm without a big performance hit.
from openlibm.
@simonbyrne I wouldn't expect openlibm to deliver correctly rounded results (we have CRlibm for that), but a high-quality math library should at the very least satisfy a small (in ULPs) error bound regardless of the prevailing rounding mode -- ideally less than an ULP.
@StefanKarpinski That's undoubtedly the simplest fix. In the long run, if someone gets ambitious they may want to investigate doing argument reduction using integer operations (on 64-bit platforms this can actually be quite efficient, and they are of course not effected by rounding mode).
from openlibm.
Related Issues (20)
- fdlibm and the Java OpenJDK
- 32 or 64 bit openlibm?
- Support for ppc32 BE? HOT 11
- Segfault while linking wasm binaries against libopenlibm HOT 2
- openlibm, fdlibm, Java openjdk? HOT 1
- openlibm Arithmetic Support? HOT 1
- MSVC _Complex not support
- Build fails on macOS with GCC: s_fpclassify.c: error: storage size of 'u' isn't known
- i387 asm does not compile under djgpp
- aarch64/fenv.c:41:23: error: invalid initializer HOT 1
- configure: error: libmpfr not found or uses a different ABI (including static vs shared). HOT 1
- makefile error HOT 1
- openlibm performance on ARM server is very poor HOT 7
- C versions of remquo deliver wrong quotient if x == -y
- ld128 coshl mishandles tiny inputs HOT 1
- Build shared lib with CMake
- Replace GNU testsuite HOT 1
- CMake build fails on macOS arm64/aarch64
- CMake parity with Makefile HOT 2
- expm1l returns NaN instead of valid number
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 openlibm.