December 2005
Beginner to intermediate
618 pages
20h 19m
English
isnormal
Tests whether a given floating-point value is normalized
#include <math.h> intisnormal( floatx); intisnormal( doublex); intisnormal( long doublex);
The macro isnormal() yields
a nonzero value (that is, true)
if its argument’s value is a normalized floating-point number.
Otherwise, isnormal() yields 0.
The argument must be a real floating-point type. The rule that
floating-point types are promoted to at least double precision for mathematical
calculations does not apply here; the argument’s properties are
determined based on its representation in its actual semantic
type.
double maximum( double a, double b )
{
if (isnormal( a ) && isnormal( b ) ) // Handle normal case first.
return ( a >= b ) ? a : b ;
else if ( isnan( a ) || isnan( b ) )
{
/* ... */Read now
Unlock full access