Precision of `Double's in Hugs

Scott Turner p.turner@computer.org
Sat, 12 Jan 2002 17:59:02 -0500


On Saturday 12 January 2002 17:35, you wrote:
> (I'm just a new convertee to the ways of Functional Programming, so
> please go easy on me! ^_^;;)

Welcome. Hope you find it as fun and useful as I.

> Why is it that `Double's in Hugs only seem to have the same
> precision as a `Float'? I've some code here that only iterates a few
> hundred times, and the amount of accuracy lost is getting a bit
> ridiculous ...

As the Hugs manual says in 9.1,
The Double type is implemented as a single precision float (this isn't 
forbidden by the standard but it is unusual).

But if you build Hugs yourself, there's a line in options.h
/* Define if you want to use double precision floating point arithmetic    */
#define USE_DOUBLE_PRECISION 0
From a bit of browsing the code, it appears that setting USE_DOUBLE_PRECISION 
will increase the precision of both Float and Double types.

> BTW: From the description at http://haskell.cs.yale.edu/communities/
> , I seem to get the impression that haskell@haskell.org should only
> be used for announcements, yet the archive shows quite a bit of
> general discussion going on. Should I have posted this to the
> aforementioned list as well / instead?

Haskell-cafe is fine for your question. For a description of the way the 
mailing lists are split, I'd recommend 
http://www.haskell.org/mailinglist.html.