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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 15 12:38:48 PDT 2010


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


Aldo Nunez <aldonunez1 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldonunez1 at gmail.com


--- Comment #1 from Aldo Nunez <aldonunez1 at gmail.com> 2010-03-15 12:38:47 PDT ---
It seems like the runtime casting of (float, double, real -> uint) and (float,
double -> ulong) can be done simpler, and in a way that would fix the -1.0 -> 0
bug.

When converting from float or double to ulong; why can't it be done like real
to ulong, where there is a simple conversion in x87 registers plus a fixup for
ulong values greater than long.max?

When converting from FP to uint; why can't it be done like FP to ushort, where
there is a simple conversion to int with x87 registers, and then a truncation?

This would make all floating point to integer conversions consistent, and get
rid of this bug where an FP -1 turns into an integer 0xFF... in some cases, and
in others 0. It should always be 0xFF..., just like a signed integer to
unsigned conversion.

-- 
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