Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-12-06 05:53:02

> Just explain that in slightly more detail and I will raise a support
> ticket with QNX.

Basically fpclassify is returning FP_NORMAL rather than FP_SUBNORMAL when
passed a denormalised number (at least that's my assumption based on the
results you reported).

The simple test case below should allow you to check this,

Regards, John.

P.S. It's probably not a good idea to post headers that aren't open-source
to a public list mailing list ;-)

#include <assert.h>
#include <math.h>
#include <limits>

template <class T>
void test(T t)
  T denorm;

  // denorm_min should be either zero or a denormalised number:
  denorm = std::numeric_limits<T>::denorm_min();
  if(denorm != static_cast<T>(0.0))
    assert(fpclassify(denorm) == FP_SUBNORMAL);

  // any number less than min() should be demormal or zero:
  denorm = std::numeric_limits<T>::min() / 2;
  if(denorm != static_cast<T>(0.0))
    assert(fpclassify(denorm) == FP_SUBNORMAL);

int main()

Boost list run by bdawes at, gregod at, cpdaniel at, john at