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

Re: integer or float?





On 2025-10-01 17:22, Lawrence Velázquez wrote:
It's valid in zsh arithmetic, so it doesn't matter whether it's
"distasteful" or "rude".  You should be formatting the output with
printf or print -f anyway, if you care about its appearance.

	% unset -v k
	% k=1.
	% printf '%d\n' $k
	1
My problem arose because of an internal string test not any display issue.  But why the dot?  Of course zsh accepts it, but why is it output like that?  Perhaps simply to flag the fact that it's been forced?  I'd have expected it to be left off unless there really is a decimal value.  Hardly a big deal tho, it's easy enough to live with.  I'm just wondering if there is a clear reason for that.








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