zsh-workers
 help / color / mirror / code / Atom feed
* printf bug
@ 2013-04-11 16:40 Yuya Amemiya
  2013-04-11 17:11 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Yuya Amemiya @ 2013-04-11 16:40 UTC (permalink / raw)
  To: zsh-workers

Hi,

I think printf built-in command has a bug.

% printf "%u\n" 0xffffffffffffffff
zsh: number truncated after 15 digits: ffffffffffffffff
1152921504606846975

% command printf "%u\n" 0xffffffffffffffff
18446744073709551615

I expect to get 18446744073709551615 from zsh built-in.

Regards


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: printf bug
  2013-04-11 16:40 printf bug Yuya Amemiya
@ 2013-04-11 17:11 ` Bart Schaefer
  2013-04-11 18:03   ` Yuya Amemiya
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2013-04-11 17:11 UTC (permalink / raw)
  To: zsh-workers

On Apr 12,  1:40am, Yuya Amemiya wrote:
}
} I think printf built-in command has a bug.
} 
} % printf "%u\n" 0xffffffffffffffff
} zsh: number truncated after 15 digits: ffffffffffffffff
} 1152921504606846975

Zsh doesn't have an internal string-to-unsigned operation, so unsigned
is limited to the range of positive signed.

You'll note that you also can't declare zsh integer-typed variables to
be unsigned.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: printf bug
  2013-04-11 17:11 ` Bart Schaefer
@ 2013-04-11 18:03   ` Yuya Amemiya
  0 siblings, 0 replies; 3+ messages in thread
From: Yuya Amemiya @ 2013-04-11 18:03 UTC (permalink / raw)
  To: zsh-workers

From: Bart Schaefer <schaefer@brasslantern.com>
Date: Thu, 11 Apr 2013 10:11:34 -0700
> Zsh doesn't have an internal string-to-unsigned operation, so unsigned
> is limited to the range of positive signed.
> 
> You'll note that you also can't declare zsh integer-typed variables to
> be unsigned.

Thanks for explanation.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-11 18:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11 16:40 printf bug Yuya Amemiya
2013-04-11 17:11 ` Bart Schaefer
2013-04-11 18:03   ` Yuya Amemiya

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).