From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1845 invoked from network); 12 Oct 2001 04:40:22 -0000 Received: from unknown (HELO sunsite.dk) (130.225.247.90) by ns1.primenet.com.au with SMTP; 12 Oct 2001 04:40:22 -0000 Received: (qmail 2285 invoked by alias); 12 Oct 2001 04:40:06 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4369 Received: (qmail 2270 invoked from network); 12 Oct 2001 04:40:05 -0000 From: Borsenkow Andrej To: "'Phil Pennock'" Cc: "'Bruno Bonfils'" , "'ZSH Users'" Subject: RE: question about float variables Date: Wed, 10 Oct 2001 14:10:23 +0400 Message-ID: <003401c15173$c65e9220$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 In-Reply-To: <20011010114224.A12923@globnix.org> Importance: Normal > > > Integer divided by integer is integer. > > Not so useful if you're manipulating parameters and you don't know what > their value is in advance. > Sigh ... zsh was meant to be used for arithmetic computations. Obvious workarounds are - multiply by 1.0: $((var1*1.0/var2)) - use temps - use float() function: $((float(var1)/var2)) What is wrong with above? BTW how is it different from C? #include main() { float f; f = 3/2; printf ("f = %f\n", f); } bor@itsrm2% cc foo.c bor@itsrm2% ./a.out f = 1.000000 > I've not seen a way in zsh to modify this to be 'sensible' for humans, If you can suggest how to 'sensibly' incorporate it into zsh grammar ... > > Personally, I'd use the OS's printf(1) if it exists, It is included into 4.1 branch. I do not know what people think about adding it into 4.0.3. -andrej