nextafter
Bob Alverson
uunet!tera.com!bob
Wed Apr 24 11:09:01 PDT 1991
Re: miscellaneous ramblings about what users want out of nextafter and
how an architecture should support it.
At Tera, we agree that nextafter(x, y) is too much to put in one hardware
instruction. However, we are thinking about computing "ulp(x, y)" such
that
nextafter(x, y) = ulp(x, y) + x
I think this scheme works for all cases except nextafter(infinity, y)
where y < infinity. Is it important that nextafter(inf, 0) give maxfloat?
Another possibility is "nextdir(x, d)" such that
nextafter(x, y) = nextdir(x, x-y).
Here, all kinds of badness can happen when computing x-y (including
underflow, overflow, invalid op, inexact) even when the end result is
not exceptional.
In any case, it's not clear nextafter deserves any architectural support
at all, given how rarely it is used.
Bob
More information about the Numeric-interest
mailing list