Description
Under MacOS...
$ gcc --version
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
a simple make
returns...
* cc bn_mp_set_double.o
bn_mp_set_double.c:55:6: warning: "mp_set_double implementation is only available on platforms with IEEE754 floating point format" [-W#warnings]
# warning "mp_set_double implementation is only available on platforms with IEEE754 floating point format"
^
1 warning generated.
...resulting in no binary for mp_set_double(). (mp_get_double() compiles fine.)
Notes:
-
LTM and LTC will not crash if mp_get_double() and mp_set_double() are not compiled. They are not called fm anywhere else in LTM or LTC. ...and only mp_set_double(), demo.c, and mpi.c are conditioned with
#if defined(__STDC_IEC_559__) || defined(__GCC_IEC_559)
-
Looking at the list of enabled defines in the attached file ( bn_mp_set_double.i.txt ), make note of those with FLT, DBL, and LDBL.
-
It appears when Apple's defines
__DBL_HAS_DENORM__
,__DBL_HAS_INFINITY__
, and__DBL_HAS_QUIET_NAN__
are true the processor supports IEEE 754/IEC 60559. Perhaps some combination of these 3 defines could be used to set__STDC_IEC_559__
? -
LTM only implements get/set for DBL. Apple supports FLT and LDBL as well. So, for the sake of completeness, perhaps we should also implement mp_get|set_float() and mp_get|set_longdouble()?
-
Finally, out of a concern for some misusing mp_get|set_double(), the doc should provide a strong caution about the possible loss of precision.
-
FWIW, all Macs since 2006 have Intel processors with integrated IEEE-754 compliant FPUs. ...as do all PPC Macs. M680x0 Mac FPUs varies.