From owner-freebsd-hackers@FreeBSD.ORG Tue May 27 02:20:17 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 737D537B401 for ; Tue, 27 May 2003 02:20:17 -0700 (PDT) Received: from cirb503493.alcatel.com.au (c18609.belrs1.nsw.optusnet.com.au [210.49.80.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E02D43F93 for ; Tue, 27 May 2003 02:20:16 -0700 (PDT) (envelope-from peterjeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])h4R9KDp9044635; Tue, 27 May 2003 19:20:13 +1000 (EST) (envelope-from jeremyp@cirb503493.alcatel.com.au) Received: (from jeremyp@localhost) by cirb503493.alcatel.com.au (8.12.8/8.12.8/Submit) id h4R9K700044634; Tue, 27 May 2003 19:20:07 +1000 (EST) Date: Tue, 27 May 2003 19:20:06 +1000 From: Peter Jeremy To: Doug Rabson Message-ID: <20030527092006.GB44520@cirb503493.alcatel.com.au> References: <200304280054.h3S0sTi2006266@lurza.secnetix.de> <200305270956.58065.dfr@nlsystems.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200305270956.58065.dfr@nlsystems.com> User-Agent: Mutt/1.4.1i cc: freebsd-hackers@freebsd.org Subject: Re: x86-64 support X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 May 2003 09:20:17 -0000 On Tue, May 27, 2003 at 09:56:58AM +0100, Doug Rabson wrote: >On Monday 28 April 2003 1:54 am, Oliver Fromme wrote: >> You don't need that; the digits of pi can be calculated >> quite easily with integer math. This snippet is from my >> signature collection: >> >> int f[9800],b,c=9814,g,i;long >> a=1e4,d,e,h;main(){for(;b=c,c-=14;i=printf( >> "%04d",e+d/a),e=d%a)while(g=--b*2)d=h*b+a*(i?f[b]:a/5),h=d/--g,f[b]=d >>%g;} >> >> Of course it doesn't comply with style(9), otherwise it >> wouldn't fit into two lines. Prettifying (de-obfuscating) >> it to make it style(9)-compliant is left as an exercise to >> the reader. ;-) > >Doesn't appear to work. When I run this, it prints '1877' followed by >lots of zeros... A followup pointed out that there is an error in the size of 'f': it should be f[9814] (matching c). With this change, the result looks reasonably close to pi. Peter