note
syphilis
<I>There may be a world where a language can do identity / symbol math ...</I><br><br>
WRT sin() and cos(), I believe it's actually fairly simple to have them return the exact rational result when applicable - as, UIM, this is only ever applicable for arguments 0, pi/6 (sin only), pi/3 (cos only), pi/2 and pi.
<br>These cases can be hard coded to return the exact correct value. (Of course, that coding has to also allow for integer multiples of those values.)
<br>It also calls for a function that takes a rational (p/q) value as it's arg.
<br><br>So, instead of calling <c>sin(1 * 3.1415926535897931)</c> and getting a non-zero result, we call (say) <c>sinpi(1)</c> and have it return the hard coded result of zero.
<br>If the arg given to our sinpi() function is not one of these "special values" (ie 0, 1/6, 1/3, 1/2 or 1 - or a multiple thereof), then <c>sinpi($arg)</c> simply returns <c>sin($arg * 3.1415926535897931)</c>
<br><br><I>... - indeed there are cpan packages for this kind of thing</I><br><br>
Do you know if there are any there that have sin/cos implementations that return exact results for all of those special values ?
<br><br>Cheers,<br>Rob
11133457
11133640