13 Jul 2002 19:32

Usual traps

Well, reading the previous comment I felt "at least a good complex library"! Unfortunately, it is not the case. For example the division and cabs functions do not take care of possible overflows or underflows in the intermediate computations so they will give wrong answers even though the result is a perfectly representable number...

01 May 2000 18:34

ccmath is outstanding.

Anybody who ever does anything with math should download this.

The form is about as clean as you'll ever see.

« Previous
1
Next »

Re: Usual traps

> Well, reading the previous comment I

> felt "at least a good complex

> library"! Unfortunately, it is not

> the case. For example the division and

> cabs functions do not take care of

> possible overflows or underflows in the

> intermediate computations so they will

> give wrong answers even though the

> result is a perfectly representable

> number...

The absence of safeguards on overflow and underflow in the complex section of the CCMATH library was a design decision. It is perfectly possible to provide such safeguards

for these instances ,however, this may only serve to obfuscate a more serious problem

in problem formulation. Clearly this would be the case if both the square and square root

of a problamatic number are required somewhere in the computation. Therefore, these

auxillary functions are not safeguarded in order to provide an early indication of possible

problems with the dynamic range of complex numbers in the computation. My feeling is

that such problems are best addressed by a reformulation of the computation rather than

a limited local fix! (Note that the complex math functions are not called by functions in

other library sections.)