[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: Arbitrary-precision floats for Guile
From: |
Hans Aberg |
Subject: |
Re: RFC: Arbitrary-precision floats for Guile |
Date: |
Tue, 1 Feb 2011 15:28:38 +0100 |
On 1 Feb 2011, at 14:57, Mark H Weaver wrote:
I want to add arbitrary-precision floats to Guile.
I'd use the mpf_t type from GNU MP.
There would be a fluid whose value would determine the minimum
precision
to use for inexact operators. A value of #f (the default) would mean
that normal floats would be used unless one of the operands was a
bigfloat.
Only checking takes a lot of time, so it is best to make a new type.
Same for integral types. So if speed is an issue, Guile ought to have
C99 integral types.
The name 'floating' seems free for such a type.
One complication is that we'd have to implement the transcendental
functions. However, I already have code to do that, as part of a
bigfloat library I wrote a while back.
There is already MPFR, which is a package of top of GMP (see the
manual of the latter).
I'd also like to add another more general representation of complex
numbers whose real and imaginary parts are each of type SCM, like the
way fractions are represented.
One might have a complexification class with one template argument.
The current Guile 'complex' type is (in my installation) the
complexification of 64-bit IEEE floats.