Re: Infinity (to the nearest integer)
Kevin Reid <kpreid-M/[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <[email protected]> |
On Oct 13, 2010, at 23:40, Bill Frantz wrote: > On 10/8/10 at 6:58 AM, tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected] (Thomas > Leonard) wrote: > >> This is a bit surprising... >> >> ? Infinity.round() >> # value: 9223372036854775807 >> >> ? NaN.floor() >> # value: 0 > > Perhaps in both cases introducing the idea of an Integer NaN is > the right answer. Division by zero should produce NaN. (I can > hear arguments for +- infinity, but is the zero + or -?) > > But integer NaNs may be too weird. Suppose we do want to produce NaN. Why do we need integer NaNs distinct from float NaNs? (This is a relevant question in other places; I've pondered using NaN and Infinity in otherwise-integer APIs, in particular streams, e.g. Infinity = "the rest of the stream".) -- Kevin Reid <http://switchb.org/kpreid/>