mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-08-23 19:01:05 +02:00
31982: detection of floating point constants was problematic.
Remove the cause and fix the original problem with floating point numbers with leading zeros (users/17445) a different way.
This commit is contained in:
parent
7a94960957
commit
4c611f9323
3 changed files with 17 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2013-11-14 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
|
* 31982: Src/math.c, Test/C01arith.ztst: detection of floating
|
||||||
|
point constants had run rampant in users/17445. Fix the original
|
||||||
|
problem another way.
|
||||||
|
|
||||||
2013-11-13 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
2013-11-13 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
* 31977: Src/module.c: no error if autoloading a feature that
|
* 31977: Src/module.c: no error if autoloading a feature that
|
||||||
|
|
11
Src/math.c
11
Src/math.c
|
@ -448,9 +448,7 @@ 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') {
|
||||||
/* Let zstrtol parse number with base */
|
/* Let zstrtol parse number with base */
|
||||||
|
@ -491,11 +489,8 @@ lexconstant(void)
|
||||||
nptr = ptr2;
|
nptr = ptr2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
while (idigit(*nptr) || *nptr == '_')
|
||||||
{
|
nptr++;
|
||||||
while (idigit(*nptr) || *nptr == '_')
|
|
||||||
nptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*nptr == '.' || *nptr == 'e' || *nptr == 'E') {
|
if (*nptr == '.' || *nptr == 'e' || *nptr == 'E') {
|
||||||
char *ptr2;
|
char *ptr2;
|
||||||
|
|
|
@ -258,3 +258,11 @@
|
||||||
>0.5
|
>0.5
|
||||||
>3
|
>3
|
||||||
>3.
|
>3.
|
||||||
|
|
||||||
|
print $(( 0x30 + 0.5 ))
|
||||||
|
print $(( 077 + 0.5 ))
|
||||||
|
(setopt octalzeroes; print $(( 077 + 0.5 )) )
|
||||||
|
0:Mixed float and non-decimal integer constants
|
||||||
|
>48.5
|
||||||
|
>77.5
|
||||||
|
>63.5
|
||||||
|
|
Loading…
Reference in a new issue