The FloatMathPlugin provided cross-platform bit-identical floating point, needed for applications such as OpenCroquet/Qwaq/terf. The plugin depends on Sun's fdlibm which is effectively obsolete. There are better solutions; see for an overview If taking this approach, instead of needing a FloatMathPlugin we could perhaps arrange that the VM provides cross-platform bit-identical floating point by default, or that the VM is compilable with some flags that result in a VM whose floating point primitives are cross-platform bit-identical. Then one wouldn't have to use an interface to the plugin, with all the headaches that providing support for SmallFloat64 now in introduces, along with the slowness of that plugin interface. — |
mpfr is multiple precision (arbitrary precision if you prefer), and not specially optimized for IEEE 754 double precision. IMO it's too much for FloatMathPlugin. CRLIBM (correctly rounded mathematical library) could be a good modern alternative to fdlibm. — |
Hi, crlibm looks indeed quite promising. If crlibm would be integrated, is it be possible to make setting rounding modes directly accessible without an FFI-call from the image? Also, I noticed that changing the rounding mode did not work reliable - possibly due to some plug/part of the vm that changes the mode on it's own behalf (freetype, maybe?). Best, Steffen Am .12.2018, 22:34 Uhr, schrieb Nicolas Cellier <[hidden email]>: |
Hi Steffen, one feature of crlibm is that it does not use current FPU rounding mode status, but has explicit functions for each rounding mode. That might be more convenient than switching FPU rounding mode for interval arithmetic for example. As for the rounding mode, I think that the VM itself does interfere For example in: there is the following definition:
#define FPU_DEFAULT (_RC_NEAR + _PC_53 + _EM_INVALID + _EM_ZERODIVIDE + _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT + _EM_DENORMAL) and a
_controlfp(FPU_DEFAULT, _MCW_EM | _MCW_RC | _MCW_PC | _MCW_IC); in
squeakExceptionHandler This is for windows VM but I'm sure we can find similar things in linux/mac Le mer. 5 déc. 2018 à 09:25, Steffen Märcker <[hidden email]> a écrit :
|
In reply to this post by David T Lewis
In the interim, we can modernize fdlibm, it's easier than creating a new plugin from scratch, and it will preserve bit-identical backward compatibility with OpenCobalt/Terf/... while changing the underlying libm would require a simultaneous change of all the VM participating. After searching for similar work in github, I saw that I would be better served by myself and gave it a go: https://github.com/nicolas-cellier-aka-nice/fdlibm/ I've run some smoke tests, but did not commit the test yet... I crafted the tests with ArbitraryPrecisionFloat package (from squeaksource), but generating the reference results is quite slow. If someone knows of existing test suite for libm, that might help. If someone wants to try it, just overwrite the fdlibm files with my master branch. No special flags required (except — |
In reply to this post by David T Lewis
I've checked that FloatMathPluginTests does not segfault anymore with head Win64 squeak.cog.spur if I replace — |
In reply to this post by David T Lewis
Now that I'm fairly confident that my patches are OK, I suggest this:
Does it sound OK? — |
In reply to this post by David T Lewis
Hi Nicolas, On Fri, Jan 4, 2019 at 7:39 AM Nicolas Cellier <[hidden email]> wrote: > Now that I'm fairly confident that my patches are OK, I suggest this: > > - we keep fdlibm for backward compatibility; > - we maintain our own patched version; > - we don't add any new feature nor try to patch anything but correct > compilation of existing source; this should generate very low level of > activity (only if C standard change and break another thing); > - for this we clone https://github.com/nicolas-cellier-aka-nice/fdlibm/ > on opensmalltalk so as to not depend on an exotic repository, and replace > the fdlibm files by using a git submodule; > - we start an alternate FloatMathPlugin implementation based on > another library (I suggest CRLibm but other suggestions are welcome). > > Does it sound OK? > Sounds perfect to me. I would add that once we have an alternate FloatMathPlugin implementation based on another library we can do the performance analysis and if it is fast enough we should implement normal floating point arithmetic with the same support and get rid of FloatMathPlugin altogether, having bit-identical floating point provided by the normal primitives. _,,,^..^,,,_ best, Eliot — |
Free forum by Nabble | Edit this page |