Program doesn't work as it should: $ seq -0.01 0.1 1 -0,01 0,09 0,19 0,29 0,39 0,49 0,59 0,69 0,79 0,89 0,99 man page: seq [OPTION]... FIRST INCREMENT LAST
What is the expected output? I can't see the bug...
> man page: > seq [OPTION]... FIRST INCREMENT LAST The last number should be LAST.
Ok, last number should be LAST, but increment should be INCREMENT... therefore you are in deadlock and there is no way out. Info pages are usually more complex than man pages in the case of coreutils and they are recommended in coreutils man pages. So please consider to use them... They say "`seq' prints the numbers from FIRST to LAST by INCREMENT." That's exactly what is the output. I really can't see a bug. It simply did what you requested - sequence from -0.01 to 1 with increment 0.1 - next number would be bigger than 1 so seq stopped. NOTABUG for me, please provide any relevant informations why should seq work like you want.
Then why this: $ seq -0.1 0.1 1 -0,1 0,0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1,0 $ seq -0.1 0.1 2 -0,1 0,0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7 1,8 1,9
Thanks, that one report makes sense, but is about different thing. It seems to be about handling floats on some architectures/systems ... I guess that issue was already fixed by upstream (in middle april this year, http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=4827dd27b0c655a685947aaa01426a5ecba179f3) and should be fixed in Fedora Rawhide, but unfortunately I can't check it at the moment. Will check it tomorrow (10PM here now) and possibly make an update for F-9.
I'm able to reproduce the issue on i386 architecture even with the latest upstream seq. Solution is quite easy - to simply add/substract DBL_EPSILON when deciding if the number is out of range. Solution proposed to upstream, we will see if it is harmless...
Thanks to Ondrej for discovering that it's locale-dependent: $ LC_ALL=C seq -0.1 0.1 2|grep 2.0 || echo bug 2.0 $ LC_ALL=cs_CZ.UTF-8 seq -0.1 0.1 2|grep 2.0 || echo bug bug Here's the fix I expect to use: diff --git a/src/seq.c b/src/seq.c index 55518df..b5f0651 100644 --- a/src/seq.c +++ b/src/seq.c @@ -309 +309 @@ print_numbers (char const *fmt, struct layout layout, - if (xstrtold (x_str + layout.prefix_len, NULL, &x_val, c_strtold) + if (xstrtold (x_str + layout.prefix_len, NULL, &x_val, strtold)
Patch and test case pushed and posted upstream: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14613
Thanks :)
coreutils-6.10-31.fc9 has been submitted as an update for Fedora 9. http://admin.fedoraproject.org/updates/coreutils-6.10-31.fc9
coreutils-6.10-33.fc9 has been pushed to the Fedora 9 stable repository. If problems still persist, please make note of it in this bug report.