Thanks for the comments.
On 12/10/2013 09:38 AM, Marc Feeley wrote:
On Dec 9, 2013, at 10:28 PM, Bradley Lucier lucier@math.purdue.edu wrote:
lib/_num.scm: Add ##flsquare, ##square, and square.
Is the naming consistent with other Schemes?
Yes.
Add ##exact-int.negative?
Fine.
Use it in ##abs. Add functions from Kahan's paper: ##kahan.abs, ##kahan.arg, ##kahan.cssqs, ##kahan.csqrt, ##kahan.cacos, ##kahan.casin, ##kahan.casinh, ##kahan.catanh, ##kahan.ctanh, ##kahan.ctan; and constants ##kahan.omega, ##kahan.epsilon, ##kahan.lambda.
I dislike the naming. Is "kahan" the best prefix? In any case, for consistency with the rest, it should be "kahan-" not "kahan." because the prefix "T." is used to name functions related to type T. Kahan is not a type (or is it?).
I renamed all the ##kahan. functions to just begin with "##c" (as in "c"omplex).
Add functions ##conjugate and conjugate.
Is the naming consistent with other Schemes?
Yes.
Marc: I'd like to have the compiler recognize ##flsquare.
Easy.
I'll attach the patch. I would really appreciate any comments.
What is missing for this patch is a bunch of unit tests. Each of the new inlined primitives should be tested for precision (after all, that is why they were added, so unit tests should verify this).
Later. I promise. :-)
New changelog and patch:
lib/_num#.scm: Add (macro-inexact-+pi/4), (macro-inexact-+3pi/4), (macro-inexact-epsilon), (macro-inexact-lambda), (macro-inexact-omega).
lib/_num.scm: Add ##flsquare, ##square, and square. Add ##exact-int.negative? Use it in ##abs. Add functions from Kahan's paper: ##cabs, ##carg, ##cssqs, ##csqrt, ##cacos, ##casin, ##casinh, ##catanh, ##ctanh, ##ctan. Add functions ##conjugate and conjugate. In ##log, use ##fllog1p for arguments near 1. In ##sin and ##cos, use real trigonometric and hyperbolic functions for complex arguments. In ##tan, use ##tanh for complex arguments. In ##asin, use ##casin. In ##acos, use ##cacos. In ##atan, use ##atanh. In ##atan2, use Kahan's conventions for infinite arguments. ##sinh, sinh, ##cosh, cosh, ##tanh, tanh, ##asinh, asinh, ##acosh, acosh, ##atanh, atanh: New functions. In ##sqrt: Use ##csqrt for complex arguments. In ##magnitude: use ##exact-int.negative? for ratnum arguments and ##cabs for complex arguments.
lib:gambit#.scm: Add entries for acosh, asinh, atanh, conjugate, cosh, sinh, square, and atanh.