Re: n accuracy



(message (Hello 'Edi)
(you :wrote :on '(Wed, 30 May 2007 09:26:35 +0200))
(

??>> Yesterday I was lisping some statistics so I needed e, considering I
??>> couldn't find it at hyperspec (too much coffein I guess) so I used
??>> (exp 1) => 2.7182818 but author of the stat book seemed to have
??>> different idea about some digits.

EW> This looks like the correct approximation for 8 digits to me.

btw, in CLISP:

[1]> (exp 1l0)
2.7182818284590452354L0
[2]> (exp 1d0)
2.718281828459045d0
[3]> (exp 1.0)
2.7182817

last value looks a bit strange, double and long versions have all digits
correct.

f>>how to tell lisp that my numbers are
f>>long-floats or made my program use bignums.

if this was a question, in CLISP you can control how long long numbers are.

(SETF (EXT:LONG-FLOAT-DIGITS) digits)

to tell that number is long, use 1.0L0 etc.
when i was in the University, i've made numeric DE solving in CLISP using
longer long numbers, and this saved me from some weird errors that other
people with doubles had. but it's a bit slow :).

only change to use bignums is to use only rational arithmetic, no "expt" and
other functions allowed.

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"I am everything you want and I am everything you need")


.



Relevant Pages

  • Re: BigNum -- Floating Point
    ... >> Thinking that BigNums will never represent non real numbers ... A completely different approach is to only compute needed digits. ... One could argue that the series of continuations to compute pi ...
    (comp.programming)
  • Re: Lisp Math Engine
    ... > fewer of them on bignums, by using the largest power of the print-base ... > that printing 8000+ digits takes a lot longer than calculating them, ... printer to print bignums by computing the digits in left-to-right ...
    (comp.lang.lisp)
  • Re: 99 ^ 99 in C
    ... calculation (three times faster than Willem's). ... Why don't you just use sizeof*CHAR_BIT bit digits, ... So I worked a little harder on getting the driver to ... can do bignums many millions of times more quickly than I can with pencil ...
    (comp.lang.c)
  • Re: n accuracy
    ... ??>> couldn't find it at hyperspec (too much coffein I guess) so I used ... EW> This looks like the correct approximation for 8 digits to me. ...
    (comp.lang.lisp)
  • Re: n accuracy
    ... couldn't find it at hyperspec (too much coffein I guess) so I used ... This looks like the correct approximation for 8 digits to me. ...
    (comp.lang.lisp)