August 13, 2014 Re: Separate Printing Mantissa and Exponent of a Floating Point | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Wednesday, 13 August 2014 at 07:58:40 UTC, Nordlöw wrote:
> {
> float x = 1.23e10;
> auto y = *cast(FloatRep*)(&x);
> writeln(y.fraction, ", ",
> y.exponent, ", ",
> y.sign);
> }
>
> {
> double x = 1.23e10;
> auto y = *cast(DoubleRep*)(&x);
> writeln(y.fraction, ", ",
> y.exponent, ", ",
> y.sign);
> }
> }
It would be nice to turn these into either
- properties or at least
- template overloads
if possible as pointer casting unsafe and error-prone.
|
Copyright © 1999-2021 by the D Language Foundation