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
[IEEE 754] OCaml does not enable rounding direction to be specified by programs #7896
Comments
Comment author: @nojb I'm not an expert on IEEE754, but it sounds like a potentially useful addition. Would you like to open a PR on https://github.com/ocaml/ocaml to discuss your code? |
FP rounding mode is another piece of global state, and I don't feel like exposing this to casual users. I'd rather leave that to a specialized, external library. Even better would be a more functional API that hides the global state. Again such an API could be developed first as an external library. |
In case this is of interest, the Interval library does this (internally). |
Yes, interval arithmetic is a great example of a nice, high-level, declarative API that changes rounding mode internally in the implementation. Actually I wonder whether there are any other common use of non-default rounding modes beyond interval arithmetic. |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
Original bug ID: 7896
Reporter: sfuric
Status: new
Resolution: open
Priority: normal
Severity: minor
Version: 4.07.0
Category: language features
Has duplicate: #3526
Monitored by: @gasche
Bug description
Some floating-point computations require rounding direction to be specified (typically to obtain safe bounds). However OCaml does not support directly this feature, so external functions have to be written (see attached code).
Steps to reproduce
Compile files in archive with:
ocamlc -c roundingMode_stubs.c
ocamlc -c roundingMode.mli
ocamlc -c roundingMode.ml
ocamlc -custom roundingMode.cmo roundingMode_stubs.o testRounding.ml
Run:
./a.out
File attachments
The text was updated successfully, but these errors were encountered: