# Re: numerical conditioning MAGNITUDE and /

This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.

```Aubrey Jaffer wrote:
> I got ahead of myself.  (where is that strawman!)

I never worry about losing a strawman, because I can
always invent another one.

Aubrey went on to provide an excellent example of
why it is better to leave some things in the fabled
"quality of implementation" category:

>  * that MAGNITUDE and / should work over their full ranges is too
>    obvious to state in a specification.
>
> How would such a constraint be expressed?  The tangent function proved
> a counterexample to general statements about the output range of
> functions.  But specifics seem workable:
>
>   The procedure MAGNITUDE returns a finite real nonnegative number for
>   every argument whose (mathematical) magnitude is less than the
>   most-positive-finite-flonum in the implementation.
>
>   The procedure / applied to z1 and z2 returns a finite number when
>   (/ (magnitude z1) (magnitude z2)) is less than the
>   most-positive-finite-flonum in the implementation.
>
> Both of these constraints are compatible with both polar and
> rectangular representations of complex numbers.

Unfortunately, both constraints are unrealistic and
largely useless.

They are unrealistic because, when the mathematically
correct result is within 1 ulp of the largest flonum,
they imply a cumulative roundoff error in the positive
direction of less than 1 ulp.

They are useless because the easiest ways to satisfy
that absurdly small bound on the positive error
involve techniques that tend to decrease rather
than to increase the accuracy of these operations:
change the rounding mode to round toward zero, use
single precision to represent all inexact reals so
double precision can be reserved for the use of
library procedures that need extra precision to
satisfy the constraints, and so on.

Furthermore the stated constraints are concerned
only with edge cases, and place no useful constraint
on the accuracy of common cases.

Legalistic attempts to require some precise quality
of implementation often inspire an equally legalistic
search for loopholes, with consequences opposite to
those intended.

Will

```