mighty-gerbils / gerbil

Gerbil Scheme
https://cons.io
GNU Lesser General Public License v2.1
1.16k stars 111 forks source link

parts of srfi 159 may be broken #433

Open pclouds opened 4 years ago

pclouds commented 4 years ago

I was trying to run 159 tests and found failed test cases, e.g.

$ ./gxi --lang r7rs
R7RS Scheme in Gerbil v0.16-DEV-478-g695a5915 on Gambit v4.9.3
> (import (std srfi 159))
> (show #f (numeric 0. 10))
"0."
> (show #f (with ((precision 2)) .997554209949891))
"00.1"

The expectation is "0.0" and "1.00".

I can't look into this yet (and no promise to do it) so I'm opening an issue here for you to keep track of it.

pclouds commented 4 years ago

If you want to try, you can check out https://github.com/pclouds/srfi-159/tree/portable-implementation-2, here's what I did

$ GERBIL_LOADPATH=$HOME/w/srfi/srfi-159/implementation/:$HOME/w/gerbil/lib/std/ ~/w/gerbil/bin/gxi --lang r7rs test.scm 
show: ............................................xxxxx.......................
................x.......x.....x............................................xx.
..............................................................................
..............................................................................
......
302 out of 312 (96.8%) tests passed in .16062402725219727 seconds.
10 failures (3.2%).
FAIL: (show #f (with ((precision 2)) .997554209949891))
    expected "1.00" but got "00.1"
FAIL: (show #f (with ((precision 2)) .9975542))
    expected "1.00" but got "00.1"
FAIL: (show #f (with ((precision 2)) .99755))
    expected "1.00" but got "00.1"
FAIL: (show #f (with ((precision 2)) .997))
    expected "1.00" but got "00.1"
FAIL: (show #f (with ((precision 2)) .99))
    expected "0.99" but got ".99"
FAIL: (show #f (with ((comma-rule 3) (decimal-sep #\,)) (numeric 2997...
    expected "299.792.458,0" but got "299.792.458,"
FAIL: (show #f (numeric 0. 10))
    expected "0.0" but got "0."
FAIL: (show #f (numeric 1. 10))
    expected "1.0" but got "1."
FAIL: (show #f (with ((sign-rule #t)) (numeric -0.)))
    expected "-0.0" but got "-0."
FAIL: (show #f (with ((sign-rule #t)) (numeric 0.)))
    expected "+0.0" but got "+0."

That one uses my own implementation (also ported from chibi) not the one that comes with Gerbil. Swapping LOADPATH to prefer Gerbil's shows a few more errors. Some related to pretty procedues which should be fixed by #360. Some others are about columnar...

vyzo commented 4 years ago

Thank you for reporting this, i was pretty sure we would have some bugs there.