[DGD]Casting to int
Felix A. Croes
felix at dworkin.nl
Fri Jun 30 12:40:48 CEST 2000
Kris Van Hees <aedil at alchar.org> wrote:
> Someone on Viking noticed a rather interesting thing... casting a float to
> an int actually does rounding, thus (int)0.51 yields 1 rather than 0. That
> seems to be quite different from e.g. C & Java where casting to an integer
> type truly returns the integer part of the number (truncating the floating
> point value rather than rounding it up or down). Any particular reason why
> DGD has taken this rather non-standard approach?
I have always thought of this the other way. It is C which is peculiar,
and the rest of the world is normal.
Then again, array indexing would have started at 1 if I had had a say
during that stage of the language's design, so perhaps it is my own
approach with is inherently non-standard.
Regards,
Dworkin
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list