From: Brian Hurt <bhurt@spnz.org>
To: romildo@uber.com.br
Cc: Ocaml Mailing List <caml-list@inria.fr>, <mgiv2595@terra.com.br>
Subject: Re: [Caml-list] float type with better precision than the default
Date: Fri, 5 Dec 2003 21:18:48 -0600 (CST) [thread overview]
Message-ID: <Pine.LNX.4.44.0312052104040.5009-100000@localhost.localdomain> (raw)
In-Reply-To: <20031206004429.GA22530@gentoo.malaquias.no-ip.org>
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
next prev parent reply other threads:[~2003-12-06 2:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-06 0:44 romildo
2003-12-06 3:18 ` Brian Hurt [this message]
2003-12-06 3:42 ` skaller
2003-12-06 11:54 ` Remi Vanicat
2003-12-08 10:11 ` Jean-Christophe Filliatre
2003-12-08 11:29 ` Jean-Christophe Filliatre
2003-12-08 11:57 ` romildo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0312052104040.5009-100000@localhost.localdomain \
--to=bhurt@spnz.org \
--cc=caml-list@inria.fr \
--cc=mgiv2595@terra.com.br \
--cc=romildo@uber.com.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).