Re: integer or float?
Bart Schaefer <[email protected]> Thu, 2 Oct 2025 14:21:56 -0700
| Newsgroups | gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CAH+w=7bc_Q4ej6rFKDZMu7DQcPG-6-+_HwuHocD8vxyVR8Xb9Q@mail.gmail.com> |
On Thu, Oct 2, 2025 at 10:35 AM Ray Andrews <[email protected]> wrote: > > Yeah, fair enough, I concede the point. we see the internal > representation there, I suppose it could be a design decision It should be noted that you're seeing an effect of FORCE_FLOAT. A scalar (string) forced to floating point by math % setopt force_float % i=1 % print $i 1 % ((i=1)) % print $i 1. Vs. a parameter created (not merely assigned) by a math expression % setopt force_float % ((j=1)) % print $j 1.0000000000 (ten decimal places is the default if not declared) Vs. a parameter declared floating point (force_float irrelevant!) % typeset -F f % ((f=1)) % print $f 1.0000000000 % typeset -F 2 f % print $f 1.00 Vs. a parameter declared integer (force_float irrelevant) % integer k % ((k=1.3)) % print $k 1