[RFC] Code for extended precision complex floating point arithmetic
Subject: [RFC] Code for extended precision complex floating point arithmetic
From: Raymond Toy
Date: Mon, 16 Jan 2006 12:45:24 -0500
>>>>> "Richard" == Richard Fateman <fateman at cs.berkeley.edu> writes:
Richard> For example, instead of using lists for <fraction, exponent> pairs,
Richard> use structures. The names here are too long but .. something like
Richard> (defstruct complex-bigfloat ( real-part bfzero :type bigfloat) (
Richard> imag-part bfzero :type bigfloat) precision)
Richard> Instead of defining complex bigfloat + as fpz+, use what amounts to
Richard> (defmethod two-arg-+ ( (x complex-bigfloat)(y complex-bigfloat)) ....
Richard> which also allows you to defineb
Richard> (defmethod two-arg-+ ((x complex-bigfloat) (y bigfloat)) ... and
Richard> (defmethod two-arg-+ ((x bigfloat) (y complex-bigfloat)) ... and
Richard> (defmethod two-arg-+ ((x complex-bigfloat)( y number)) ... for all
Richard> common lisp number types.
Richard> Oh, you define generic + in terms of two-arg-+, so you can also do
Richard> (+ a b c) for complex bigfloats a b c.
Richard> What does this get you:
Richard> More versatility
Richard> Probably slower speed
I, for one, would like to see some of these changes. The nice part
would be that many algorithms would work with either real or complex
args, so having CLOS and methods would mean I wouldn't have to
re-write them. And since numerical algorithms are usually pretty hard
work, not having to write it again is a major win.
And I'd like to see the 1F1 and 2F1 functions implemented too, since
that means we get bigfloat implmentations of other special functions
like Bessel essentially for free. :-)
Ray