On 19 November 2012 06:19, Walter Bright <newshound2@digitalmars.com> wrote:
On 11/18/2012 4:31 PM, Manu wrote:Because they are implemented in hardware. It's pretty dang hard for a compiler to look at a floating point emulator and figure out "gee, I have a nice hardware instruction that does the same thing as this 2K of code!"
If I told you this is how real should be implemented, would you vote ++? What
about double? Why?
Why not float for that matter? There seems like no reason for the language to
define any floating point type at all if you consider this acceptable...
It's implemented in GPUs, sure, but it is it implemented in hardware that D runs on? (I do know about this: http://gcc.gnu.org/onlinedocs/gcc/Half_002dPrecision.html)'half' isn't some custom float for niche use, it's an established standard,
implemented in vastly more hardware than implements 'real'.
There is no major technical difficulty in implementing it as a basic type, but I want to be sure we've exhausted the library approach first.