Unable to explicitly cast imaginary float to a real floating-point (dmd v0.165)

David L. Davis SpottedTiger at yahoo.com
Wed Aug 30 15:24:11 PDT 2006


// WinXP SP2, D v0.165
// cast1.d
// Unable to explicitly cast a imaginary float to a real floating-point.
private import std.stdio;

int main()
{
    ifloat ift = 234.67fi;
    real   r  = cast(real)ift;

    writefln("ift=%gi, r=%g", ift, r);

    return 0;
}

Output:
--------
C:\dmd>dmd cast1.d
C:\dmd\bin\..\..\dm\bin\link.exe cast1,,,user32+kernel32/noi;

C:\dmd>cast1
ift=234.67i, r=0

C:\dmd>

-------------------------------------------------------------------
"Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
-------------------------------------------------------------------

MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html 





More information about the Digitalmars-d-bugs mailing list