zsh-workers
 help / color / mirror / code / Atom feed
* zcal bug
@ 2013-03-18 15:06 sergio
  2013-03-18 15:37 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: sergio @ 2013-03-18 15:06 UTC (permalink / raw)
  To: zsh-workers

Hi.

This is a bug, right?

% zcalc
$1 > 122114.671875
122115
$2 >

(I've received id as the result of 125045424.0 / 1024.0)

-- 
sergio.


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

* Re: zcal bug
  2013-03-18 15:06 zcal bug sergio
@ 2013-03-18 15:37 ` Peter Stephenson
  2013-03-18 15:42   ` Peter Stephenson
  2013-03-18 15:55   ` sergio
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Stephenson @ 2013-03-18 15:37 UTC (permalink / raw)
  To: zsh-workers

On Mon, 18 Mar 2013 19:06:48 +0400
sergio <mailbox@sergio.spb.ru> wrote:
> This is a bug, right?
> 
> % zcalc
> $1 > 122114.671875
> 122115
> $2 >
> 
> (I've received id as the result of 125045424.0 / 1024.0)

What do you think is the bug?  That it's rounding to six decimal places?
As it says in the zshcontrib manual, that's the normal effect of the
printf %g format.  If you want the output to have raw format, which
might show more decimal places than the actual precision, use :raw.

-- 
Peter Stephenson <p.stephenson@samsung.com>       Principal Software Engineer
Tel: +44 (0)1223 434724              Samsung Cambridge Solution Centre
St John's House, St John's Innovation Park,
Cowley Road, Cambridge, CB4 0DS, UK


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

* Re: zcal bug
  2013-03-18 15:37 ` Peter Stephenson
@ 2013-03-18 15:42   ` Peter Stephenson
  2013-03-18 15:55   ` sergio
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2013-03-18 15:42 UTC (permalink / raw)
  Cc: zsh-workers

On Mon, 18 Mar 2013 15:37:28 +0000
Peter Stephenson <p.stephenson@samsung.com> wrote:

> On Mon, 18 Mar 2013 19:06:48 +0400
> sergio <mailbox@sergio.spb.ru> wrote:
> > This is a bug, right?
> > 
> > % zcalc
> > $1 > 122114.671875
> > 122115
> > $2 >
> > 
> > (I've received id as the result of 125045424.0 / 1024.0)
> 
> What do you think is the bug?  That it's rounding to six decimal places?

I meant significant figures, obviously...

pws


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

* Re: zcal bug
  2013-03-18 15:37 ` Peter Stephenson
  2013-03-18 15:42   ` Peter Stephenson
@ 2013-03-18 15:55   ` sergio
  2013-03-18 16:05     ` Peter Stephenson
  1 sibling, 1 reply; 5+ messages in thread
From: sergio @ 2013-03-18 15:55 UTC (permalink / raw)
  To: zsh-workers


> printf %g format.

Sorry, I confused it with %f.


-- 
sergio.


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

* Re: zcal bug
  2013-03-18 15:55   ` sergio
@ 2013-03-18 16:05     ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2013-03-18 16:05 UTC (permalink / raw)
  To: zsh-workers

On Mon, 18 Mar 2013 19:55:32 +0400
sergio <mailbox@sergio.spb.ru> wrote:
> > printf %g format.
> 
> Sorry, I confused it with %f.

I have to say it confused *me* working out what a sensible default was.
You really want something like a really calculator does, but that's (I
suppose, I don't know what the firmware looks like) presumably taking
some arbitrary number of significant figures that they've worked out
will be correct for the precision used internally.  For a slightly more
general purpose programmer's tool like zcalc, sticking with the standard
formats available seemed a more obvious thing to do.  %g looked like the
least worst option.

pws


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

end of thread, other threads:[~2013-03-18 16:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-18 15:06 zcal bug sergio
2013-03-18 15:37 ` Peter Stephenson
2013-03-18 15:42   ` Peter Stephenson
2013-03-18 15:55   ` sergio
2013-03-18 16:05     ` Peter Stephenson

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).