@hackage qd0.4.1

double-double and quad-double number type via libqd

  • Categories

  • License

    BSD-3-Clause

  • Maintainer

    claudiusmaximus@goto10.org

  • Versions

    • 1.0.2.1 Mon, 15 Oct 2012
    • 1.0 Fri, 10 Jun 2011
    • 0.4.1 Tue, 8 Feb 2011
    • 0.4 Sun, 30 Jan 2011
    • 0.2 Wed, 20 Oct 2010
    • 0.1 Mon, 18 Oct 2010

This package supports both a double-double datatype (approx. 32 decimal digits) and a quad-double datatype (approx. 64 decimal digits), using libqd (which is implemented in C++ with C and Fortran wrappers). To compile this package you need libqd to be installed.

Numeric.QD.DoubleDouble.DoubleDouble and Numeric.QD.QuadDouble.QuadDouble are strict tuples of CDoubles, with instances of: Eq, Floating, Fractional, Num, Ord, Read, Real, RealFloat, RealFrac, Show, Storable, Typeable.

Additional note: libqd depends on 64bit doubles, while some FPU architectures use 80bit. It is highly recommended to compile with -fno-excess-precision and set the FPU control words to avoid erroneous behaviour, perhaps by doing something like this at the start of your program:

import Foreign (nullPtr)
import GHC.Conc (forkOnIO, numCapabilities)
import Numeric.QD.FPU.Raw (fpu_fix_start)
main :: IO ()
main = do
  mapM_ (flip forkOnIO $ fpu_fix_start nullPtr) [ 0 .. numCapabilities - 1 ]
  -- ...