diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/math.c | 3 | ||||
-rw-r--r-- | Test/C01arith.ztst | 16 |
3 files changed, 23 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 9eded1a3f..2bded0120 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-10-16 Peter Stephenson <pws@csr.com> + + * 25905: Src/math.c, Test/C01arith.ztst: fix and test doubled-hash + radix output syntax. + 2008-10-14 Barton E. Schaefer <schaefer@zsh.org> * 25887: Completion/Unix/Type/_path_files: pass -U to compadd only diff --git a/Src/math.c b/Src/math.c index 241445979..29556d973 100644 --- a/Src/math.c +++ b/Src/math.c @@ -670,7 +670,8 @@ zzlex(void) } if(*ptr != ']') goto bofs; - if (outputradix < 2 || outputradix > 36) { + n = (outputradix < 0) ? -outputradix : outputradix; + if (n < 2 || n > 36) { zerr("invalid base (must be 2 to 36 inclusive): %d", outputradix); return EOI; diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst index 5179948bd..02612bd79 100644 --- a/Test/C01arith.ztst +++ b/Test/C01arith.ztst @@ -172,3 +172,19 @@ print $(( 3 + "OK"); echo "Worked") 0:not a parse failure because not arithmetic >+ OK Worked + + fn() { + emulate -L zsh + print $(( [#16] 255 )) + print $(( [##16] 255 )) + setopt cbases + print $(( [#16] 255 )) + print $(( [##16] 255 )) + } + fn +0:doubled # in base removes radix +>16#FF +>FF +>0xFF +>FF + |