Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#222 LOG of large integers is broken

lisp error
closed-fixed
Sam Steingold
clisp (525)
5
2009-01-18
2004-08-11
Sam Steingold
No

(log (ash 1 100000))
*** - floating point overflow

it would appear that a simple method
of discarding unnecessary digits and returning

(+ (* N (log 2)) (log (ash X (- N))))

for large X and appropriate N would solve this problem.

Discussion

  • Bruno Haible
    Bruno Haible
    2004-08-11

    Logged In: YES
    user_id=5923

    Agreed. The only thing to be careful about is that (log 2) needs
    to be computed in extended precision, because by multiplying
    with N any round-off errors in computing (log 2) is multiplied with
    |N|.

     
  • Sam Steingold
    Sam Steingold
    2004-08-11

    Logged In: YES
    user_id=5735

    R_ln_R() already computes (log 2)
    with the (presumably) correct precision.

    all that remains to be determined is
    how many integer digits are needed
    for the specific float output.
    i.e., the exponent of the appropriate float epsilon.

     
  • Sam Steingold
    Sam Steingold
    2009-01-18

    • assigned_to: haible --> sds
    • status: open --> closed-fixed
     
  • Sam Steingold
    Sam Steingold
    2009-01-18

    thank you for your bug report.
    the bug has been fixed in the CVS tree.
    you can either wait for the next release (recommended)
    or check out the current CVS tree (see http://clisp.cons.org\)
    and build CLISP from the sources (be advised that between
    releases the CVS tree is very unstable and may not even build
    on your platform).