#2361 [ARM] Strange one-liner numerical precision issue

closed
nobody
5
2012-03-08
2012-02-26
Snark
No

I'm porting sage (http://www.sagemath.org) to ARM, and hit various kind of problems ; one of them hits maxima :
(%i1) 1.7e+17;
(%o1) 1.6999999999999998e+17

sage has maxima version 5.24.0 using Lisp ECL 11.1.1 (and I checked ECL returns 1.7e+17 when given 1.7e+17).

I don't know where to start looking for the issue.

Discussion

  • Raymond Toy
    Raymond Toy
    2012-02-26

    Floating point numbers are printed by the routine exploden in commac.lisp.

    For this particular number, maxima essentially uses the result of

    (format nil "~ve" 21 1.7d17)

    If plain ecl prints something besides 1.7d17, then it's probably an issue with ecl on ARM.

    (Or maybe 5.24.0 is too old? Try a more recent version of ecl.)

    Maxima current git with ecl 11.1 prints 1.7e17 as expected. So does cmucl.

     
  • Snark
    Snark
    2012-02-27

    Let me rephrase my initial report, as it seems I haven't made it clear: sage has maxima version 5.24.0 using Lisp ECL 11.1.1.

    On x86_64, everything looks fine.

    On ARM, ECL is fine, and maxima isn't.

    Is it possible to have maxima display a float as hexadecimal, to check if the internal representation is right or if the problems lies before?

     
  • Raymond Toy
    Raymond Toy
    2012-02-28

    I'm not interesting in debugging an issue in 5.24.0 when 5.26.0 is the current release.

    It would certainly help to isolate the problem if you could tell me what ecl/arm says for

    (format t "~ve" 21 1.7d17)

    There's no easy way to get hexadecimal representation, but you can examine the float using integer-decode-float (in lisp).

     
  • Snark
    Snark
    2012-02-28

    Here is what ecl says :
    > (format nil "~ve" 21 1.7d17)
    "1.6999999999999998d+17"

    so the problem is with ecl and I'm chasing the wrong goose :-/

    Sorry for the noise.

     
  • Raymond Toy
    Raymond Toy
    2012-03-08

    • status: open --> closed
     
  • Raymond Toy
    Raymond Toy
    2012-03-08

    Closing bug. Issue is with ecl's format routine on ARM. Ecl prints the expected value on x86.