digitalmars.D - How to deal with systems where real == double
- Johannes Pfau (10/10) Apr 28 2013 How do we want to deal with systems which have no floating point type
- Peter Alexander (11/27) Apr 28 2013 First should be sufficient, but I suppose both if you want to
- Walter Bright (3/3) Apr 29 2013 real is defined to be the largest floating point type supported on the t...
How do we want to deal with systems which have no floating point type bigger than double? * What's the proper check to detect this in druntime / phobos? (real.sizeof == double.sizeof) or (real.mant_dig == double.mant_dig)? * Should the long double functions (tanl, cosl) be available from druntime? If so we need to alias them. Glibc does not provide the long double functions on a target without long double. * What about phobos functions overloads using "real"? Should those be disabled completely or should they call the "double" equivalent function?
Apr 28 2013
On Sunday, 28 April 2013 at 08:39:47 UTC, Johannes Pfau wrote:How do we want to deal with systems which have no floating point type bigger than double? * What's the proper check to detect this in druntime / phobos? (real.sizeof == double.sizeof) or (real.mant_dig == double.mant_dig)?First should be sufficient, but I suppose both if you want to account for some hypothetical machine where the sizes are the same, but have a different number of mantissa bits.* Should the long double functions (tanl, cosl) be available from druntime? If so we need to alias them. Glibc does not provide the long double functions on a target without long double.I think they should be available and just use the double versions. I don't see much point in needlessly breaking code that uses reals when they're the same as doubles.* What about phobos functions overloads using "real"? Should those be disabled completely or should they call the "double" equivalent function?They should be aliases to the double versions or just call them. Not sure which, but we definitely should not just disable those overloads otherwise we just break code that uses reals unnecessarily.
Apr 28 2013
real is defined to be the largest floating point type supported on the target machine, so if that's the same as double, then it's double (though still a distinct type to the D typing system).
Apr 29 2013