From: Raymond T. <to...@rt...> - 2002-07-19 13:14:51
|
>>>>> "Arseny" == Arseny Slobodjuck <am...@ic...> writes: Arseny> Hello, Raymond, Arseny> Friday, July 19, 2002, 3:11:35 AM, you wrote: Raymond> Yes. If you could, can you tell me why the computation of tan Raymond> requires the computation of sqrt? Don't bother if it's lengthy. Just Raymond> curious. Arseny> I have an supposition: it allows to compute only one of sin or cos, not both Arseny> (supposing sqrt being calculated more quickly than trigonometric function). Arseny> For example tg(a) = (+-)sqrt((1-cos(2a))/(1+cos(2a))). >> Sounds reasonable. Seems that this has lots of extra round-off >> problems than just computing cos(a), though. Arseny> This formula doesn't have sqrt(0) problem for tg(pi/2) (it haves Arseny> sqrt(inf) one). Yep. Arseny> If you mean sqrt(x - > 0) error, it can be fixed (if the code doesn't Arseny> contain a workaround already). For example sqrt(x) = sqrt(n^2 * x) / Arseny> n (There are possibly exist smarter workarounds, I don't know). Somehow these workarounds just seem to complicate things. Aren't they good algorithms that can comput sin and cos at the same time with only slightly more cost than just sin? I know the CORDIC algorithms do this. Ray |