[Issue 3970] Problem with cast -1.0L ==> uint/ulong

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 7 09:07:45 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=3970



--- Comment #2 from Don <clugdbug at yahoo.com.au> 2013-01-07 09:07:42 PST ---
This passes on Linux32 and 64, on 1.076 and 2.061. Also tested on D1.073 so it
has been working for quite some time on Linux. Need to check if it is
Windows-specific.

void main() {
    static assert((cast(ushort)(-1.0)) == 0xFFFF);
    static assert((cast(ushort)(-1.0L)) == 0xFFFF);
    static assert((cast(uint)(-1.0)) == 0xFFFF_FFFF);
    static assert((cast(uint)(-1.0L)) == 0xFFFF_FFFF);
    static assert((cast(ulong)(-1.0L)) == 0xFFFF_FFFF_FFFF_FFFFUL);

    assert((cast(ushort)(-1.0)) == 0xFFFF);
    assert((cast(ushort)(-1.0L)) == 0xFFFF);
    assert((cast(uint)(-1.0)) == 0xFFFF_FFFF);
    assert((cast(uint)(-1.0L)) == 0xFFFF_FFFF);
    assert((cast(ulong)(-1.0L)) == 0xFFFF_FFFF_FFFF_FFFFUL);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list