From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16924 invoked from network); 30 Jul 2008 13:13:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 30 Jul 2008 13:13:47 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 13903 invoked from network); 30 Jul 2008 13:13:44 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Jul 2008 13:13:44 -0000 Received: (qmail 4947 invoked by alias); 30 Jul 2008 13:13:41 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25353 Received: (qmail 4936 invoked from network); 30 Jul 2008 13:13:41 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 30 Jul 2008 13:13:41 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [208.87.233.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 61FA88027216 for ; Wed, 30 Jul 2008 15:13:25 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly04g.srv.mailcontrol.com (MailControl) with ESMTP id m6UDDLGU015544 for ; Wed, 30 Jul 2008 14:13:22 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Wed, 30 Jul 2008 14:13:21 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.2/8.13.4) with ESMTP id m6UDDL3R023415 for ; Wed, 30 Jul 2008 14:13:21 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.14.2/8.14.2/Submit) with ESMTP id m6UDDLDI023411 for ; Wed, 30 Jul 2008 14:13:21 +0100 Message-Id: <200807301313.m6UDDLDI023411@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk Subject: Re: wrong value for pi? In-reply-to: <20080730125458.GB1113@plenz.com> References: <20080730125458.GB1113@plenz.com> Comments: In-reply-to Julius Plenz message dated "Wed, 30 Jul 2008 14:54:58 +0200." Date: Wed, 30 Jul 2008 14:13:21 +0100 From: Peter Stephenson X-OriginalArrivalTime: 30 Jul 2008 13:13:21.0089 (UTC) FILETIME=[0A15C310:01C8F246] X-Scanned-By: MailControl A-08-50-03 (www.mailcontrol.com) on 10.71.0.114 X-Virus-Scanned: ClamAV version 0.92.1, clamav-milter version 0.92.1 on bifrost X-Virus-Status: Clean Julius Plenz wrote: > Hi! > > Playing around, I noticed that Z-Shell wrongly evaluates the > expression "4.0*atan(1)" (which is equal to pi): > > zsh> zmodload zsh/mathfunc > zsh> typeset -F 48 pi='4.0*atan(1)' > zsh> echo $pi > 3.141592653589793115997963468544185161590576171875 > ^- here the first error occurs > > Is this indended, a bug or just owing to some sort of optimization or some C > library's shortcomings? It's simply a question of what double precision actually gives on your system, as it says in the manual (" Floating point arithmetic always uses the ‘double’ type with whatever corresponding precision is provided by the compiler and the library."). Beyond that the digits will certainly be gobbledygook. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070