From owner-freebsd-hackers@FreeBSD.ORG Sun Apr 27 17:54:32 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 8873337B401 for ; Sun, 27 Apr 2003 17:54:32 -0700 (PDT) Received: from lurza.secnetix.de (lurza.secnetix.de [212.66.1.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 771C643FA3 for ; Sun, 27 Apr 2003 17:54:31 -0700 (PDT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (hevuhu@localhost [127.0.0.1]) by lurza.secnetix.de (8.12.8p1/8.12.8) with ESMTP id h3S0sTB5006267 for ; Mon, 28 Apr 2003 02:54:30 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.12.8p1/8.12.8/Submit) id h3S0sTi2006266; Mon, 28 Apr 2003 02:54:29 +0200 (CEST) Date: Mon, 28 Apr 2003 02:54:29 +0200 (CEST) Message-Id: <200304280054.h3S0sTi2006266@lurza.secnetix.de> From: Oliver Fromme To: freebsd-hackers@FreeBSD.ORG In-Reply-To: <20030427065621.G40030-100000@haldjas.folklore.ee> X-Newsgroups: list.freebsd-hackers User-Agent: tin/1.5.4-20000523 ("1959") (UNIX) (FreeBSD/4.8-RELEASE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: x86-64 support X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: freebsd-hackers@FreeBSD.ORG List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Apr 2003 00:54:32 -0000 Narvi wrote: > On Sat, 26 Apr 2003, M. Warner Losh wrote: > > In message: <20030427064014.H40030-100000@haldjas.folklore.ee> > > Narvi writes: > > : option USE_PI_DIGITS 100 > > > > Only if you could implement it with integer math :-) > > where's the problem in that ? most mp libs use integer arithmetic, and > x86-64 gives you 64x64->128 bit widening multiplies 8-) 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. ;-) Regards Oliver PS: The number of digits is specified by the iteration counter c which starts at 9814 in this case, producing 2800 digits (35 rows on an 80-columns terminal). The counter should be initialized with (digits / 4 + 1) * 14. Don't forget to make the f[] array sufficiently large. -- Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "Any sufficiently advanced technology is indistinguishable from magic." Arthur C. Clarke's Third Law, from Profiles of the Future