need isnan and isinf src for microsoft c

Richard Tobin richard at aiai.ed.ac.uk
Tue Apr 30 01:19:15 AEST 1991


In article <1991Apr22.173940.25021 at solo.csci.unt.edu> gene at ponder.csci.unt.edu (Gene De Lisa) writes:
>Could someone tell me how to detect NaN and infinite numbers

Infinities have the exponent set to its maximum value and the mantissa
zero.  NaNs have the same exponent but a non-zero mantissa.

For single precision the format is sign bit, 8 bit exponent, 23 bit mantissa.
For double precision the numbers are 11 and 52.

>in microsoft c?

Assuming it uses IEEE format, as above, but you have to be careful
about byte order.

-- Richard
-- 
Richard Tobin,                       JANET: R.Tobin at uk.ac.ed             
AI Applications Institute,           ARPA:  R.Tobin%uk.ac.ed at nsfnet-relay.ac.uk
Edinburgh University.                UUCP:  ...!ukc!ed.ac.uk!R.Tobin



More information about the Comp.lang.c mailing list