This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

isnan()


We recently needed to use the isnan() function and noticed that it is
a.) a function and not an inline and b.) does not handle SNaN properly.
I couldn't find any other C library that handles SNaN in isnan()
properly either and thus I ventured to implement it. Here is the
implementation if you care to update glibc. The advantage of this
implementation is that it is inline and it will handle SNaN. A test is
also included.

-> icc -DIEEE -I. ieeeNaNTest.c
-> ./a.out
snan: nan
qnan: nan
snan == nan:  PASS
snan == snan:  PASS
snan != qnan:  PASS
qnan == nan:  PASS
qnan == qnan:  PASS
qnan != snan:  PASS

For some reason I couldn't compile this with gcc. It appears that "long
long" is missing for some reason.

Robert

-- 
Robert Schweikert                   MAY THE SOURCE BE WITH YOU
rjschwei@cox.net                               LINUX

Attachment: ieeeNaN.tgz
Description: application/compressed-tar


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]