Re: Infinity (to the nearest integer)
Kevin Reid <kpreid-M/[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <[email protected]> |
[This is a combined reply to several messages.] On Oct 14, 2010, at 16:00, Karp, Alan H wrote: > Kevin Reid wrote: >> >> Suppose we do want to produce NaN. Why do we need integer NaNs >> distinct from float NaNs? >> > Because every bit pattern in an integer register is a valid fixed > point number, which leaves no way to denote NaN. You've just argued *against* having an integer-NaN value, it seems to me. I didn't ask "can we have an integer NaN". I asked "given that an integer operation is going to return NaN, should it be distinct from the float NaN?" No matter what we decide .floor() (which, to review, is an operation taking a double and returning a bigint) does in the inf/NaN cases, *something* other than 'put the result into an integer register' has to happen (unless we decide to return 0). I don't see that any of the options (throw, "integer NaN" which in practice would be an arbitrary object pointer from the perspective of the runtime, or double NaN) is going to be notably *more* expensive in the Hypothetical Optimizing Implementation. On Oct 14, 2010, at 15:19, Jonathan S. Shapiro wrote: > Personally, I don't think integer BigNums make a lot of sense. > Distinguished infinities only make sense when the representation has > bounded magnitude I don't understand what these two sentences have to do with each other. Could you explain further? On Oct 14, 2010, at 15:20, Jonathan S. Shapiro wrote: > If infinity or NaN values of any sort are introduced, it is > important that they have the same representation on all platforms. What do you mean by "representation"? The representation of values in memory? On disk? Semantically visible distinctions? -- Kevin Reid <http://switchb.org/kpreid/>