half and quad

Paul Anderson paul.d.anderson.removethis at comcast.andthis.net
Thu Oct 11 13:19:20 PDT 2007


Olifant Wrote:

> Unlike C++, D seems to be pretty consistent with basic numeric types, such as clearly defining the exact bitsize of integers ranging from 8 to 128 bits, and floating point numbers ranging from 32 and 64 bit.
> 
> However, what appears to be missing are half precision and quad precision floating point numbers. I know they're not really standard yet, but they will be soon (http://en.wikipedia.org/wiki/IEEE_754r). The range of exact bitsizes for floating point numbers in D could be extended from 16 to 128 bit.
> 
> The keyword "cent" is reserved for 128-bit integers. Could "half" and "quad" be reserved for respectively 16-bit and 128-bit floating point numbers?
> 
> If the 128-bit floating point numbers are standard, then it will be nice to have "quad" to cover those, instead of using the type "real" that doesn't really specify the size.
> 
> And "half" could be very useful in some algorithms such as those on GPU-like processors.
> 
> It would be quite dirty if D would after so many years when those things are standard, have to come up with some bad names for those types similar to how "wchar_t" in C++ is a bad name.

And this would imply reserving chalf, cquad, ihalf & iquad as well.

As usual, the problem is breaking existing code. I've never (IIRC) used "quad" as a variable name, but I've used "half" on numerous occasions.

But I think this is a good idea.

Paul



More information about the Digitalmars-d mailing list