zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: PATCH: my "SECONDS can be floating point" tweaks
Date: Thu, 31 Oct 2002 05:09:31 +0000	[thread overview]
Message-ID: <1021031050931.ZM5514@candle.brasslantern.com> (raw)
In-Reply-To: <20021030211750.GA6296@scuzzy.blorf.net>

On Oct 30,  1:17pm, Wayne Davison wrote:
} Subject: PATCH: my "SECONDS can be floating point" tweaks
}
} I won't commit this until I get some positive feedback about the
} changes.

I think they look good, except (maybe) for one thing:

} First, the intseconds{get,set}fn() functions are implemented by calling
} the float* versions.

Is converting to float and then back to integer (or the other way round
for the setfn) really going to give the same results as a computation
directly on only shtimer.tv_sec?

I wouldn't want to lose or gain an entire second due to rounding errors
when e.g. doing arithmetic in a loop on the integer SECONDS.

(Is "rounding" the right description anyway?  Isn't it _truncated_ to an
integer when the parameter is not set to float?)

I otherwise like the simplicity of this approach.

} The second change may be more controversial.  I introduced two new
} functions that allow us to get and set the "raw" (non-relative to now)
} value of the SECONDS variable (though the value is returned as a
} double).  I then added some code to builtin.c that saves this raw value
} into the cached off u.dval, and changed the new code in params.c that
} was adding local-elapsed time into the parent variable to just reload
} the raw parent value.

I must be sleepy or especially dense at the moment, but I don't follow
what this means from the point of view of the _caller_ of a function in
which SECONDS is local.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2002-10-31  5:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-28 18:55 PATCH: SECONDS can be floating point Peter Stephenson
2002-10-29 10:40 ` Peter Stephenson
2002-10-29 11:23   ` Peter Stephenson
2002-10-29 17:52     ` Wayne Davison
2002-10-29 18:08     ` Wayne Davison
2002-10-29 18:13       ` Peter Stephenson
2002-10-30 21:17 ` PATCH: my "SECONDS can be floating point" tweaks Wayne Davison
2002-10-31  5:09   ` Bart Schaefer [this message]
2002-10-31 18:53     ` Wayne Davison
2002-10-31 10:34   ` Peter Stephenson
2002-10-31 18:53     ` Wayne Davison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1021031050931.ZM5514@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).