Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
integer or float?
- X-seq: zsh-users 30359
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: integer or float?
- Date: Wed, 1 Oct 2025 12:57:26 -0700
- Archived-at: <https://zsh.org/users/30359>
- List-id: <zsh-users.zsh.org>
Accidentally left option forcefloat active
and a function of mine stopped working. It boils down to this:
4 /aWorking/Zsh/Source/Wk 4 % cat test
#!/usr/bin/zsh
integer MAX_INDEX=2
local idx=
for ((idx=$MAX_INDEX; idx>0; idx--)); do
echo $idx
done
4 /aWorking/Zsh/Source/Wk 4 % unsetopt forcefloat; .test
2
1
4 /aWorking/Zsh/Source/Wk 4 % setopt forcefloat; . test
2.
1.
... anyway I've figured out that 'integer idx' cures the problem,
so it seems that forcefloat affects a scalar but not an integer
which seems backwards. Also, '1.' is mathematically distasteful
is it not? The trailing dot is rude, one might expect '1.0' or
just leave the dot off when there is no actual float value.
Thoughts?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author