mirror of
https://git.code.sf.net/p/zsh/code
synced 2026-04-18 06:53:35 -04:00
54313: convfloat: use consistent capitalisation for NaN, Inf, and -Inf
makes `typeset -p` use the same capitalisation as arithmetic expansion
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2026-04-13 dana <dana@dana.is>
|
||||
|
||||
* 54313: README, Src/params.c, Test/B02typeset.ztst: convfloat:
|
||||
use consistent capitalisation for NaN, Inf, and -Inf
|
||||
|
||||
2026-04-13 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||
|
||||
* 54327: Completion/Zsh/Type/_parameters: names with dot are
|
||||
|
||||
4
README
4
README
@@ -132,6 +132,10 @@ The zsh/datetime module's strftime builtin now exports a set-but-empty
|
||||
TZ parameter (as in `TZ= strftime ...`) for use by the underlying
|
||||
library. On most systems, this is equivalent to setting TZ to UTC.
|
||||
|
||||
The typeset builtin now prints the floating-point values NaN, Inf, and
|
||||
-Inf using that capitalisation, which matches the capitalisation used by
|
||||
arithmetic expansion. (Previously they were printed in lowercase.)
|
||||
|
||||
Incompatibilities between 5.8.1 and 5.9
|
||||
---------------------------------------
|
||||
|
||||
|
||||
@@ -5752,7 +5752,12 @@ convfloat(double dval, int digits, int flags, FILE *fout)
|
||||
setlocale(LC_NUMERIC, "POSIX");
|
||||
#endif
|
||||
if (fout) {
|
||||
fprintf(fout, fmt, digits, dval);
|
||||
if (isinf(dval))
|
||||
fprintf(fout, (dval < 0.0) ? "-Inf" : "Inf");
|
||||
else if (isnan(dval))
|
||||
fprintf(fout, "NaN");
|
||||
else
|
||||
fprintf(fout, fmt, digits, dval);
|
||||
ret = NULL;
|
||||
} else {
|
||||
VARARR(char, buf, 512 + digits);
|
||||
|
||||
@@ -1177,3 +1177,12 @@ F:This is a bug, the non -h variable should not hide the autoload variable
|
||||
>z=SRANDOM (zsh/random)
|
||||
>z=
|
||||
>v=
|
||||
|
||||
() {
|
||||
typeset -F f1=nan f2=inf f3=-inf
|
||||
typeset -p f1 f2 f3
|
||||
}
|
||||
0:float NaN/Inf output formatting
|
||||
>typeset -F f1=NaN
|
||||
>typeset -F f2=Inf
|
||||
>typeset -F f3=-Inf
|
||||
|
||||
Reference in New Issue
Block a user