Maximilian Wilson wrote:
On 12/2/05, Anthony Borla <[EMAIL PROTECTED]> wrote:
I *do* miss implict type conversion behaviour [e.g. C 'type promotions'],
and have been bitten [numerous times] by simple code such as:
<float> / <int>
The thing about type conversions is that they can be lossy (i.e. lose
information), and worse, they're silently lossy.
For the sake of completeness, the picture is even worse in Mozart than
in C. In C all integers convert to valid floats. This is not the case
in Mozart, since floats have fixed size in memory, while integers don't.
So some integers are rounded to Inf!
I stepped into that problem with my Minesweeper. The program counts the
total number of solutions of a given problem with integers. This number
is printed as a float, just because of the simpler format. I was once
surprised when it printed "Inf", because I just tried a problem with
more than 10^100 solutions ;-) The "counting" part of the program
simply does not work with floats!
Cheers,
raph
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users