From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10195 invoked from network); 11 Mar 2004 11:36:02 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Mar 2004 11:36:02 -0000 Received: (qmail 9917 invoked by alias); 11 Mar 2004 11:35:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19599 Received: (qmail 9900 invoked from network); 11 Mar 2004 11:35:48 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 11 Mar 2004 11:35:48 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.211] by sunsite.dk (MessageWall 1.0.8) with SMTP; 11 Mar 2004 11:35:47 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-22.tower-36.messagelabs.com!1079004947!4540596 X-StarScan-Version: 5.2.5; banners=-,-,- X-Originating-IP: [158.234.9.163] Received: (qmail 10112 invoked from network); 11 Mar 2004 11:35:47 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-22.tower-36.messagelabs.com with SMTP; 11 Mar 2004 11:35:47 -0000 Received: from trentino.logica.co.uk ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id i2BBZkCk027860; Thu, 11 Mar 2004 11:35:46 GMT Received: from trentino.logica.co.uk (localhost [127.0.0.1]) by trentino.logica.co.uk (Postfix) with ESMTP id 440EB79721C1; Thu, 11 Mar 2004 12:35:02 +0100 (CET) Cc: zsh-workers@sunsite.dk X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- In-reply-to: From: Oliver Kiddle References: To: "Nelson H. F. Beebe" Subject: Re: News: zsh-4.1.1-nonstop-fp Date: Thu, 11 Mar 2004 12:35:02 +0100 Message-ID: <22419.1079004902@trentino.logica.co.uk> 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