Compile time float binary representation

Walter Bright newshound1 at digitalmars.com
Fri Jul 31 18:53:57 PDT 2009


Jeremie Pelletier wrote:
> Is there a way to convert a float (or double/real) to an integral number without changing its binary representation at compile time?
> 
> I need to extract the sign, exponent and mantissa yet I cant use bit shifting.
> "Error: 'R' is not of integral type, it is a real" is the error I get.
> 
> The usual *cast(uint*)&value wont work either at compile time.
> 
> Any suggestions?

There's currently no way to do that.



More information about the Digitalmars-d mailing list