-
Notifications
You must be signed in to change notification settings - Fork 12
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
Format of floating point numbers #22
Comments
I fear, it doesn't really end there. |
Isn't it sufficient to say that floating point operations in SOM must be IEE 754 compatible? |
I guess, one could say that optimizations are only allowed if they are identities according to the IEEE-754 standard. But that would seem to preclude things such as I guess, it would be nice if accuracy is never worse than when following IEEE-754. |
If I understand that paper correctly, it doesn't change IEEE-754, it just reorders source-level expressions so that they're less subject to rounding (which is something experienced programmers do anyway, to some extent). So I think IEEE-754 is still a reasonable spec to adhere to? |
47: Implement basic support for doubles. r=ptersilie a=ltratt This implements operations such as `+-*` (though note that Doubles don't implement `/` in SOM!) but not comparisons (as we really need to improve some of our other support before it's worth fixing doubles) and many other necessary operations. However, it does largely integrate Doubles into the internal type system. Note that this PR starts to diverge from SOM for minor reasons over formatting of doubles (SOM-st/SOM#22) and inconsistencies in Java SOM (at least) (SOM-st/SOM#20). Hopefully we will be able to fix that divergence at some point. Co-authored-by: Laurence Tratt <[email protected]>
AFAIK, SOM doesn't specify how floating point numbers should be converted to strings, so there is almost certainly inconsistency across implementations. To my surprise, printing floating point numbers turns out to be an active area of research, with the recent best algorithm appearing only in 2018.
yksom
uses an implementation of Ryū to print out floating point numbers and it is subtly different than java-som. Consider the program:java-som prints:
whereas yksom prints:
i.e. 1.0737418251E9 -> 1073741825.1.
There are C and Java implementations of Ryū, so it is probably feasible to specify that's how floating point numbers should be printed? I admit this is a small issue in the grand scheme of things, at most, but it does make it harder to test multiple SOM variants.
The text was updated successfully, but these errors were encountered: