Aldo Nunez wrote:
Don Wrote:

The cast(uint) case is clearly a bug. Please file it in Bugzilla.

I'll file a bug, but...

This happens because there are no built-in functions for converting from float to unsigned. Values between int.max and uint.max need to be treated specially.



You're right, but why isn't it done for (float, double -> ulong) like it's done for 
(real -> ulong), where it's a simple conversion to long plus a fixup. It's not like 
(float -> real -> ulong) will introduce more precise non-zero bits (or will it?).

Then there's the case of (float, double, real -> uint). Why isn't this done like 
(float, double, real -> ushort), where a simple conversion to int is done, and 
then the result is truncated to ushort? Wouldn't it work the same to do a simple 
conversion to long, and then truncate the result to uint?

I'm just trying to understand why these simple, yet seemingly just as accurate 
methods weren't used.

I don't know, but it's probably historical. The real->ulong code is quite recent (about a year old), but the other ones are ancient. They may even come from the 386 days.

Reply via email to