CustomFloat

Benji Smith dlanguage at benjismith.net
Fri Oct 17 17:34:14 PDT 2008


Andrei Alexandrescu wrote:
> Yah, graphics is a big target for such types (and a big pusher for 
> standardizing them). I need such numbers for different purposes, i.e. 
> storing large arrays of probability distribution. In that case the range 
> is [0, 1] and I need to cram those numbers in as little space as 
> possible. I could definitely use a customized floating point layout.

I'll be damned. That was my exact same use case!

I didn't implement a standard half-precision float, though. Knowing that 
I'd never have negative values, my type didn't have a sign bit at all. I 
think I had a 11-bit mantissa and a 5-bit exponent... or something like 
that.

--benji



More information about the Digitalmars-d mailing list