half and quad

Anders F Björklund afb at algonet.se
Fri Oct 12 01:10:26 PDT 2007


Bill Baxter wrote:

> I don't have anything against putting a half type in.
> I guess I'd rather see it as something like an intrinsic module than a 
> reserved keyword, though.  Something implemented by the compiler, but 
> you have to do an import to get at it.

That's how it works now, with "half" being a typedef for ushort...
All math is done in the "float" type, half is just for the storage.

It can be used from C even, using the appropriate function calls.
But it's easier to use in C++, with the overloaded operators etc ?

//	    half a (3.5);
//	    float b (a + sqrt (a));
//	    a += b;
//	    b += a;
//	    b = a + 7;

--anders



More information about the Digitalmars-d mailing list