I am amazed that noone has had a thought on the business problem here.

Frankly, I'm amazed that anyone expects exact results from a
float-point value. By its very nature it is an approximation.

The issue is not that the narrowing/widening behavior changed since it
was ALWAYS allowed to, per specification.

The issue is not that you can't get repeatable results since you
ALWAYS could do so using explicit casts, and ONLY by doing so would
you have _reliably_ gotten such results in the presence of
mix-resolution values (Single v. Double).

The issue is that you should NOT use floating-point values when you
need precise decimal representation; if you need that, use Decimal.
The correct reason for using floating-point values is when you need to
deal with a large _RANGE_ of values in terms of absolute magnitude,
not "just" to get decimal places.

If we want to fix anything, let's not worry about enabling people to
continue using the wrong datatype.  This is just like when the
designed the CLR to store character data as Unicode natively, and told
people that wanted to play with the bytes directly to get them from
the appropriate encoding.  Without that design decision, we would be
dealing with tons more buffer overflows, encoding breaks, etc.

--
"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination of
their C programs." --Robert Firth

Marc C. Brooks
http://musingmarc.blogspot.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to