zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: "Nelson H. F. Beebe" <beebe@math.utah.edu>
Cc: zsh-workers@sunsite.dk
Subject: Re: News: zsh-4.1.1-nonstop-fp
Date: Thu, 11 Mar 2004 12:35:02 +0100	[thread overview]
Message-ID: <22419.1079004902@trentino.logica.co.uk> (raw)
In-Reply-To: <CMM.0.92.0.1078585195.beebe@psi.math.utah.edu>

On 6 Mar, "Nelson H. F. Beebe" wrote:
> 
> that contains improvements in the handling of floating-point
> arithmetic.  I invite comments from the zsh developers, and I plan in

This definitely looks good to me.

It's a pity printf outputs `nan' and `inf' in lowercase while it
otherwise uses `NaN' and `Inf'. The printf builtin could be changed but
it isn't trivial because of things like the width modifiers. printf's
output may even be platform specific.

It might be better to add readonly special variables named Inf and NaN
instead of modifying zzlex to do a strcmp. Given the following existing
behaviour, I think that'd work:
  % y=x
  % x=3.141
  % echo $(( y ))
  3.141

Note that you can do things like:
  (( x = 1.0 / 0.0 ))
instead of:
  x=$(( 1.0 / 0.0 ))

You are otherwise getting conversions via a string which is less
efficient and for some numbers will lose you a lot of precision.

Similarly, the builtin printf allows things like:
  printf '%g\n' x
instead of:
  printf '%g\n' $x
and even things like:
  printf '%g\n' '1.0 / 0.0'

I just noticed that the scripts used the other forms which may be
necessary for compatibility with other shells.

Looking through the patch Clint sent, we could probably remove the
NONSTOP_FP preprocessor define. Can't see that we'd have a need for a
--disable-nonstop-fp configure option. The ksh93-test.sh script is
testing the capabilities of various shells rather than the nonstop-fp
functionality so we probably don't need it. Examples from the README
could be adapted for something in the Test directory though.

Oliver


      parent reply	other threads:[~2004-03-11 11:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-06 14:59 Nelson H. F. Beebe
2004-03-11  4:39 ` Clint Adams
2004-03-11 11:35 ` Oliver Kiddle [this message]

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=22419.1079004902@trentino.logica.co.uk \
    --to=okiddle@yahoo.co.uk \
    --cc=beebe@math.utah.edu \
    --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).