DOC: undefined type of idouble + double
    Don Clugston 
    dac at nospam.com.au
       
    Tue Mar  7 07:22:48 PST 2006
    
    
  
Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Don Clugston schrieb am 2006-03-02:
>> Thomas Kuehne wrote:
>>> http://www.digitalmars.com/d/type.html
>>> "Usual Arithmetic Conversions" doesn't list any of the following
>>> conversions:
>>>
>>> float -> cfloat
>>> ifloat -> cfloat
>>> double -> cdouble
>>> idouble -> cdouble
>>> real -> creal
>>> ireal -> creal
>>>
>>> http://www.digitalmars.com/d/float.html
>>> "Complex and Imaginary types" documents the conversions above:
>>>> There is no particular complex literal syntax, just add a real and
>>>> imaginary type.
>>> DMD-0.148 allows the promotion to complex types.
>> It does, but it shouldn't.
>> Adding a real and an imaginary type to form a complex does not have 
>> to involve implicit promotion to complex. In fact, it can't, because 
>> then you get problems with the sign of zero.
> 
> Exactly what would be the problems besides implementation bugs?
The problem is that
-0.0 + 0.0 = -0.0
+0.0 - 0.0 = +0.0
So if you always promote imaginary numbers by adding +0.0,
then you get
-0.0 + 7.0i  = creal (-0.0 + 7.0i)
but
7.0i - 0.0  = creal (+0.0 + 7.0i)
    
    
More information about the Digitalmars-d-bugs
mailing list