1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-12 13:21:15 +02:00

users/17445: fix handling of leading zeroes in floating point

This commit is contained in:
Bart Schaefer 2012-12-08 19:50:20 +00:00
parent 968a7a2a51
commit 431c22024d
3 changed files with 19 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2012-12-08 Bart Schaefer <schaefer@zsh.org>
* users/17445: Src/math.c, Test/C01arith.ztst: fix handling of
leading zeroes in floating point.
2012-11-20 Oliver Kiddle <opk@zsh.org> 2012-11-20 Oliver Kiddle <opk@zsh.org>
* 30811: Completion/Linux/Command/_btrfs, * 30811: Completion/Linux/Command/_btrfs,
@ -6,7 +11,7 @@
2012-11-16 Vin Shelton <acs@xemacs.org> 2012-11-16 Vin Shelton <acs@xemacs.org>
* Doc/Zsh/grammar.yo: users/16865: Added missing menu item for Errors. * users/16865: Doc/Zsh/grammar.yo: Added missing menu item for Errors.
2012-11-18 Bart Schaefer <schaefer@zsh.org> 2012-11-18 Bart Schaefer <schaefer@zsh.org>
@ -363,5 +368,5 @@
***************************************************** *****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL * This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5765 $ * $Revision: 1.5766 $
***************************************************** *****************************************************

View file

@ -447,7 +447,8 @@ lexconstant(void)
if (*nptr == '-') if (*nptr == '-')
nptr++; nptr++;
if (*nptr == '0') if (*nptr == '0' &&
(memchr(nptr, '.', strlen(nptr)) == NULL))
{ {
nptr++; nptr++;
if (*nptr == 'x' || *nptr == 'X') { if (*nptr == 'x' || *nptr == 'X') {

View file

@ -152,6 +152,16 @@
0:commas and parentheses, part 1 0:commas and parentheses, part 1
>4 >4
print $(( 07.5 ))
(setopt octalzeroes; print $(( 09.5 )))
0:leading zero doesn't affect floating point
>7.5
>9.5
(setopt octalzeroes; print $(( 09 )))
1:octalzeroes rejects invalid constants
?(eval):1: bad math expression: operator expected at `9 '
(setopt octalzeroes; print $(( 08#77 ))) (setopt octalzeroes; print $(( 08#77 )))
0:octalzeroes doesn't affect bases 0:octalzeroes doesn't affect bases
>63 >63