Re: Testing for IEEE infinity and NaN?
- From: "Fred J. Tydeman" <tydeman@xxxxxxxxx>
- Date: Fri, 16 Jun 2006 14:05:49 GMT
On Thu, 15 Jun 2006 17:15:41 UTC, Raymond Toy <raymond.toy@xxxxxxxxxxxx> wrote:
Is there a "fast" way to check if an IEEE floating-point number is
infinity? I pretty sure that NaN can be test easily by doing x = x,
which is always true, except if x i NaN. Is there something just as
easy for infinity? Or do I have to look at the exponent of the number
to figure that out?
In C99 terms:
#define isnan(x) ( (x) != (x) )
#define isinf(x) ( !isnan(x) && isnan( (x) - (x) ) )
---
Fred J. Tydeman Tydeman Consulting
tydeman@xxxxxxxxx Testing, numerics, programming
+1 (775) 358-9748 Vice-chair of J11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.
.
- Follow-Ups:
- Re: Testing for IEEE infinity and NaN?
- From: Nick Maclaren
- Re: Testing for IEEE infinity and NaN?
- References:
- Testing for IEEE infinity and NaN?
- From: Raymond Toy
- Testing for IEEE infinity and NaN?
- Prev by Date: Re: Testing for IEEE infinity and NaN?
- Next by Date: Re: Decimal carry-save adder using reversed biquinary notation
- Previous by thread: Re: Short-circuiting the optimizer
- Next by thread: Re: Testing for IEEE infinity and NaN?
- Index(es):
Relevant Pages
|
|