This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
>>>>> "Dirk" == Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes: Dirk> On 12 Nov 1998, Valentin Kamyshenko wrote: Dirk> If I understand R5RS correctly, the tower has to be Dirk> integers -- rational -- real -- complex I've just meant, that 'after rationals' can be 'complex rationals' and 'floats' (both real and complex). Of course, it was not the best illustration :). Moreover, it was misleading, because I wanted to say, that the main difficulty, in my opinion, is that each function that works with numbers (like ATAN, for example), must recognize also rational argument(s). Am I right? Dirk> Although it is assumed that converting an exact integer to an Dirk> inexact with exact-> inexact will use a floating point representation, this is not Dirk> necessarily the case: Bignums could simply have an added Dirk> inexact-flag which is set accordingly by exact->inexact and Dirk> inexact->exact. Can you say few more words, in what situations it could be useful? Dirk> Still, there are a couple of possibilities to represent the Dirk> different numbers and the types they correspond to: (N: integer, Dirk> Q: rational, R: real, C: complex) Dirk> immediate (exact) --> NQRC bignum (exact) --> NQRC Dirk> immediate1/immediate2 (exact) --> N if immediate2 == 1, QRC Dirk> bignum/immediate2 (exact) --> N if immediate2 == 1, QRC Dirk> immediage1/bignum2 (exact) --> N if bignum2 == 1, QRC Dirk> bignum1/bignum2 (exact) --> N if bignum2 == 1, QRC float Dirk> (inexact) --> N if (= x (round x)), QRC Could not we exclude many possibilities at once, stating that we use 'the most effective representation'? I mean, each bignum should be transformed to immediate int. as soon as it becomes possible; rationals with denominator 1 -> integer (bignum or immediate); in complex, if Re is inexact, then Im is transformed to inexact, and vise-versa. Does not it lead to unique representation? By the way, do you know, how is it organized now? I suppose, that (let ((A (expt 2 100))) (- A (- A 10))) returns 10 as immediate, does not it? Dirk> Some time ago I took a look at numbers.c and numbers.h to figure Dirk> out how to minimize the interface, maybe to make it easier to Dirk> try out the gmp representation (GNU multiprecision library). gmp Dirk> offers very effective implementations for bignums and rationals Dirk> with a nice and well designed interface. The results have made Dirk> their way onto Jim's TODO list. Well, 1/2 of the work has been done :). -- All the best, V.Kamyshenko.