da Silva, Joe wrote:
function Complex_ArcTan (z: Complex): Complex; var x, y, a, b, c, d: Real; begin x := Abs (Re (z)); y := Abs (Im (z)); b := 1 - y; d := (1 + y) / 2; if b < 0 then d := -d; b := Abs (b); if x >= b then begin c := b / x; d := d * c - x / 2;
[Joe da Silva]
Perhaps it's impossible to avoid overflow under all conditions? In this case, if Im(z) is large and Re(z) is small, then "d" will overflow here because "c" is now large too. :-/
But that's the `x >= b' case. :-)
It seems that even the wheel was invented in San Diego :-)
[Joe da Silva]
No, it was invented in Australia! See the following! : <G> http://www.theage.com.au/news/state/2001/07/02/FFX0ADFPLOC.html
Nice. I'm surprised, though, that this didn't happen in the US first ... ;-)
Frank