scientific: Numbers represented using scientific notation
Data.Scientific provides the number type
Scientific. Scientific numbers are
arbitrary precision and space efficient. They are represented using
The implementation uses a coefficient
c :: and a base-10 exponent
e :: . A scientific number corresponds to the
fromInteger c * 10
Note that since we're using an
Int to represent the exponent these numbers
aren't truly arbitrary precision. I intend to change the type of the exponent
Integer in a future release.
The main application of
Scientific is to be used as the target of parsing
arbitrary precision numbers coming from an untrusted source. The advantages
Rational for this are that:
Scientificis more efficient to construct. Rational numbers need to be constructed using
%which has to compute the
Scientificis safe against numbers with huge exponents. For example:
1e1000000000 ::will fill up all space and crash your program. Scientific works as expected:
read "1e1000000000" :: Scientific1.0e1000000000
Also, the space usage of converting scientific numbers with huge exponents to
Float) will always be bounded by the target type.
Depend on the bytestring-builder package for backwards compatibility.
Use the integer-simple package instead of integer-gmp
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
- scientific-0.3.6.0.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.