From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA07582; Sat, 6 Dec 2003 03:18:39 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA07534 for ; Sat, 6 Dec 2003 03:18:37 +0100 (MET) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hB62Ia123595 for ; Sat, 6 Dec 2003 03:18:36 +0100 (MET) Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id hB62IHC22752; Fri, 5 Dec 2003 20:18:21 -0600 (CST) Date: Fri, 5 Dec 2003 21:18:48 -0600 (CST) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: romildo@uber.com.br cc: Ocaml Mailing List , Subject: Re: [Caml-list] float type with better precision than the default In-Reply-To: <20031206004429.GA22530@gentoo.malaquias.no-ip.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 romildo:01 floats:01 sol:99 gmp:01 floats:01 teaches:99 numerically:01 implements:01 -bit:01 -bit:01 ocaml:01 float:02 float:02 arbitrary:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 5 Dec 2003 romildo@uber.com.br wrote: > Hello. > > A friend of mine needs a type for float numbers > with better precision than the precision offered > in the default float type. He also needs efficiency > in his application. Ocaml floats are spec'd to be IEEE 754 double precision. This gives you enough accuracy to measure the distance from here to the moon in microns- 15 decimal digits. 30 decimal digits is enough accuracy to measure the distance between here and the Andromeda Galaxy in microns. Why does he need such a ridiculous amount of precision? But the short answer is he is basically SOL. The x86 has an 80-bit FP format (~18 digits of accuracy), and the PA-RISC can do 128-bit FP at a signifigant performance hit (1/2 the speed of double precision, IIRC). But no one else I know of does more than double precision in hardware. Which means software emulation, and really slow performance. You might gain a little by hardcoding the precision (GMP implements arbitrary precision floats), but not enough to make up the difference. Especially after, as I predict, you discover that 30 bits of precision isn't enough either. Instead, I'd recommend your friend take his algorithm over some day to whatever nearby college you have and find whomever teaches the Numerical Analysis class, and talk the algorithm over with that professor. I'd bet dollars to donuts that his algorithm is numerically unstable, and once he's done taking that professor's advice, double precision will be more than enough precision. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners