From: Raymond T. <to...@rt...> - 2002-07-17 18:57:07
|
>>>>> "Marco" == Marco Baringer <em...@be...> writes: Marco> Raymond Toy <to...@rt...> writes: >> Note that tan(pi/2) differs quite a bit from 1/cos(pi/2). While I >> don't consider this a bug, I do think it's rather inconsistent since >> sin(pi/2) is essentially 1 so that tan(pi/2) should be essentially >> equal to 1/cos(pi/2). It almost seems as if some intermediate Marco> you are asking for two infinte numbers, and CLISP is giving you two Marco> infinte numbers, or as close as CLISP can get to infinity. since it Marco> goes about calculating them in different ways it gives you different Marco> infinities, but this is what hapens when you ask for something which Marco> doesn't exist. No, I'm not asking for infinite numbers. I'm asking Clisp to compute tan (and cos) for the (mathematically) rational number (/ pi 2). And if Clisp really wanted to return the "closest" to infinity, most-positive-long-float would have been a better answer. Clisp returns it's best answer. That's fine. Note that I wasn't complaining that the numbers are wrong (CMUCL says the result is positive, not negative), just that tan and 1/cos gave significantly different numbers when I expected them to be much closer. They don't have to be exactly equal, but should be closer than the 7-8 digits it gets now. Note that CMUCL says (zerop (tan (/ pi 2)) (/ (cos (/ pi 2)))) is T, which actually exceeded my expectations. Marco> the cool thing to do would be to implement "trigonometric" numbers ala Marco> complex and rationals...ie where pi was NOT 3.14159....but exactly Marco> 4arctan(1). That's a different issue. :-) Maxima solves this pretty well. Ray |