Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: arithmetic anomaly



> On Mar 26, 2021, at 5:45 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> 
> On 2021-03-26 10:09 a.m., Lawrence Velázquez wrote:
>> 
>>     printf '%s %.0f\n' 'zsh (%.0f):' '22.0**22'
>> 
> Interesting I was formatting with the same ' %.0f ' but getting  the ca. 200 character output.  ' %s ' is no improvement.

22^22 is not 200 digits long. We're not talking about the same
input.

% cat /tmp/demo.zsh
python3.9 <<\EOF
print(f"{'Python:':<11} {100**100}")
EOF

printf '%-10s %s\n' 'zsh (%s):' $(( 100.0**100 ))

printf '%s %.0f\n' 'zsh (%.0f):' '100.0**100'
% zsh /tmp/demo.zsh
Python:     100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
zsh (%s):  9.9999999999999997e+199
zsh (%.0f): 99999999999999996973312221251036165947450327545502362648241750950346848435554075534196338404706251868027512415973882408182135734368278484639385041047239877871023591066789981811181813306167128854888448


> How do I get her to trim it down?

*it

vq




Messages sorted by: Reverse Date, Date, Thread, Author