Best way to "convert" a real to ireal
    Carsten Sørensen 
    cso at rift.dk
       
    Thu Sep 13 04:59:41 PDT 2007
    
    
  
Christian Kamm wrote:
> I don't think there is. The properties are mentioned here
> http://www.digitalmars.com/d/property.html
> among the properties of floating point types, but not really documented.
> 
> I expect .im behaves the way it does since that's how it's used in
> mathematics. So c.im * 1.0i is the right way to make it an ireal.
Thanks for your reply! I suppose (well, hope really) the compiler does 
the right thing when multiplying by 1.0i.
I just had a brainwave regarding the imaginary part of creal -
---
creal c = 1.0 + 1.0i;
ireal i = cast(ireal)c;
---
does exactly what I want. Isn't it just obvious in hindsight...
Best regards,
Carsten Sørensen
    
    
More information about the Digitalmars-d-learn
mailing list