Raw binary(to work without OS) in D
Don Clugston
dac at nospam.com
Thu Jun 28 08:28:09 PDT 2012
On 28/06/12 17:00, Jens Mueller wrote:
> Andrei Alexandrescu wrote:
>> On 6/28/12 10:07 AM, Roman D. Boiko wrote:
>>> On Thursday, 28 June 2012 at 14:04:37 UTC, Mehrdad wrote:
>>>> I think just exposing them via .sig and .exp might be the way to go?
>>>
>>> sig is easy to confuse with sign
>>
>> .mantissa and .exp
>
> Letting the compiler define these properties is a solution. I thought
> Don is looking for something more general. But maybe this isn't needed
> here. Don't know. But using mantissa should be discouraged.
> I suggest calling them
> .significand and .exponent
>
> significand is preferred over mantissa by IEEE FP committee. I think
> it's fine to spell them out. There won't be much code using them anyway.
>
> Jens
Yes, adding new properties would be the easiest way from a CTFE
perspective; that way, they are endian-ness independent. It's a bit
niche, but then again adding a special case for this in CTFE is niche as
well. Maybe it would be the best approach.
With naming, I'm included to agree, but the funny thing is that we have
X.mant_dig as the number of digits in the significand.
There's an oddity, though: the type of X.significand would be dependent
on the type of X (and for the non-existent quadruple float, it would be
non-existent ucent type!)
Would it include the implicit bit of an 80-bit x87 real (the silly bit)?
More information about the Digitalmars-d
mailing list