www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 715] New: incorrect IEEE 754 handling of -0i and +0i

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=715

           Summary: incorrect IEEE 754 handling of -0i and +0i
           Product: D
           Version: 0.177
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: thomas-dloop kuehne.cn


#
# union F{
#    float f;
#    uint i;
# }
#
# union I{
#    ifloat f;
#    uint i;
# }
#
# void foo(){
#    // success with "float"
#    F f;
#    f.f = 0.0f;
#    f.f *= -1.0f;
#    assert(f.i == 0x80000000);
#
#    // failure with "ifloat"
#    I i;
#    i.f = 0.0fi;
#    i.f *= -1.0fi;
#    assert(i.i == 0x80000000);
# }
#

test cases:
http://dstress.kuehne.cn/run/ieee_754_zerosdq_01.d
http://dstress.kuehne.cn/run/ieee_754_zerosdq_02.d
http://dstress.kuehne.cn/run/ieee_754_zerosdq_03.d
http://dstress.kuehne.cn/run/ieee_754_zerosdq_04.d


-- 
Dec 22 2006
next sibling parent Don Clugston <dac nospam.com.au> writes:
This creates a real, not an imaginary. It shouldn't compile at all.

 # union I{
 #    ifloat f;
 #    uint i;
 # }
 #
 # void foo(){
 #    I i;
 #    i.f = 0.0fi;
 #    i.f *= -1.0fi;   <<  This should be i.f *= -1.0f;
 #    assert(i.i == 0x80000000);
 # }

Dec 23 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=715


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #2 from thomas-dloop kuehne.cn  2006-12-23 07:13 -------
Thanks for catching this. I've fixed the test cases and refiled the issue as
#730 


-- 
Dec 23 2006