Working with floating point numbers

Working with floating point numbers

Post by Robert J. Sprawl » Mon, 01 Jun 1998 04:00:00



Hello,
    I'm doing some floating point work and need some answers to
questions not covered in the headers.

1. I can test a float type value by promoting it to a double and testing
it against the ranges set within float.h, but how would I go about
testing a double? Should I promote it to a long double and test it that
way? There is also the issue of compiler compatibility. This project
will be move to a DOS platform and compiled using WATCOM, which does not
define a long double( actually a long double can be declared, but it is
acutally declaring a double ). My code is currently written to test a
double against a NAN. It this the best way, only way?

2. Does GCC define infinity/INF?

I will present more questions as they come up.

--

Tactical Dynamics                       http://home.att.net/~sprawlsr
ICQ: 12017245
        "The first principle in riding a tiger is to hang on
         tight to it's ears"
                                        Robert A. Heinlein
                                        Stranger in a Strange Land

 
 
 

Working with floating point numbers

Post by Martin Kahle » Wed, 03 Jun 1998 04:00:00


[Posted and mailed]



Quote:> 1. I can test a float type value by promoting it to a double and testing
> it against the ranges set within float.h, but how would I go about
> testing a double?

man isinf, isnan, finite?

Just a suggestion, i hope i didn't miss the point.
Martin.