Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-09-11 14:54:48

"Paul A. Bristow" wrote:
> Attached is a tranlsation of ACM TOMS 715.f ANORM into C++.
> It does the normal distribution function.
> (NOT yet Boostified before anyone comments!)
> (prob.cpp is the function, prob.h just declares it, test.cpp
> and its results in a .txt file (also pasted into the prob.cpp
> at the end)

I'd expect that the case
   if (x > 8.572)
should return 1, not 0.

The normal distribution is defined for all (real) arguments
x, therefore its domain is easy.

> I see no reason why an exception should be raised if the argument falls
> outside the values, as the value 0 or 1 should be returned.

Yes, the function is mathematically defined for all (real)
arguments. An IEEE-aware implementation should probably check
for x == NaN and short-circuit that case.

> Cody says:
> C Error returns
> C The program returns ANORM = 0 for ARG .LE. XLOW.

Not an error, just a normal result.

> but I don't see (as a mad scientist and not a mad mathematican)
> why this is an error or needs flagging, except that the result
> might be denormalised

What's wrong with the result being denormalized?

Jens Maurer

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