On Mon, 16 Aug 2010, Matteo Sisti Sette wrote:
However there seem to be some inconsistency: 5/4 returns 0 (as I was used to), not +inf.
5/4 is not a division by 0, it's a division by 4.
and then, if it were a division by 0... that should give NaN. It can't be NaN because, among other things, you can't even know which sign of the infinity it should give, let alone whether "infinity" is a proper way to describe what's happening.
If you accept limits (as in "the limit of 1/x as x goes towards 0") as a suitable mathematical device in this context, then it gives +Inf when x decreases towards 0, but it gives -Inf when x increases towards 0. In such cases, the limit is usually said to "not exist".
If you copy the sign of the zero to decide whether the result is +Inf or -Inf, then you violate the rule that the sign of the zero shouldn't matter...
Also, I'm not sure +inf is the value you expect when adding something to the greatest representable value... or is it?
Infinity in the float format is a misnomer. It should really be called TooBig or something like that. In an Extended Reals context, this means that each infinity is used to approximate all values (of the same sign) that are too big, but in a plain Reals context, infinities don't really exist, so each "infinity" is just the set of all finite numbers that are two big (for each sign).
you know what I mean ?
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801