scientific: Numbers represented using scientific notation
Data.Scientific provides a space efficient and arbitrary precision
scientific number type.
Scientific numbers are represented using
scientific notation. It
uses a coefficient c :: and a base-10 exponent Integere :: (do
note that since we're using an IntInt to represent the exponent these numbers
aren't truly arbitrary precision). A scientific number corresponds to the
Fractional number: .fromInteger c * 10 ^^ e
The main application of Scientific is to be used as the target of parsing
arbitrary precision numbers coming from an untrusted source. The advantages
over using Rational for this are that:
A
Scientificis more efficient to construct. Rational numbers need to be constructed using%which has to compute thegcdof thenumeratoranddenominator.Scientificis safe against numbers with huge exponents. For example:1e1000000000 ::will fill up all space and crash your program. Scientific works as expected:Rational
> read "1e1000000000" :: Scientific 1.0e1000000000
Also, the space usage of converting scientific numbers with huge exponents to
(like:IntegralsInt) or(like:RealFloatsDoubleorFloat) will always be bounded by the target type.
Flags
Manual Flags
| Name | Description | Default |
|---|---|---|
| bytestring-builder | Provide the Data.ByteString.Builder.Scientific module (requires bytestring >= 0.10) | Enabled |
Automatic Flags
| Name | Description | Default |
|---|---|---|
| integer-simple | Use the integer-simple package instead of integer-gmp | Disabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
Downloads
- scientific-0.3.2.2.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
| Versions [RSS] | 0.0.0.0, 0.0.0.1, 0.0.0.2, 0.1.0.0, 0.1.0.1, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.3.0.0, 0.3.0.1, 0.3.0.2, 0.3.1.0, 0.3.2.0, 0.3.2.1, 0.3.2.2, 0.3.3.0, 0.3.3.1, 0.3.3.2, 0.3.3.3, 0.3.3.4, 0.3.3.5, 0.3.3.6, 0.3.3.7, 0.3.3.8, 0.3.4.0, 0.3.4.1, 0.3.4.2, 0.3.4.3, 0.3.4.4, 0.3.4.5, 0.3.4.6, 0.3.4.7, 0.3.4.8, 0.3.4.9, 0.3.4.10, 0.3.4.11, 0.3.4.12, 0.3.4.13, 0.3.4.14, 0.3.4.15, 0.3.5.0, 0.3.5.1, 0.3.5.2, 0.3.5.3, 0.3.6.0, 0.3.6.1, 0.3.6.2, 0.3.7.0, 0.3.8.0, 0.3.8.1 |
|---|---|
| Change log | changelog |
| Dependencies | array (>=0.1 && <0.6), base (>=4.3 && <4.8), bytestring (>=0.10 && <0.11), deepseq (>=1.3 && <1.4), ghc-prim, hashable (>=1.1.2 && <1.3), integer-gmp, integer-simple, text (>=0.8 && <1.3) [details] |
| License | BSD-3-Clause |
| Author | Bas van Dijk |
| Maintainer | Bas van Dijk <v.dijk.bas@gmail.com> |
| Uploaded | by BasVanDijk at 2014-07-11T10:32:49Z |
| Category | Data |
| Home page | https://github.com/basvandijk/scientific |
| Bug tracker | https://github.com/basvandijk/scientific/issues |
| Source repo | head: git clone git://github.com/basvandijk/scientific.git |
| Distributions | Arch:0.3.8.0, Debian:0.3.6.2, Fedora:0.3.8.0, FreeBSD:0.3.3.8, LTSHaskell:0.3.8.1, NixOS:0.3.8.0, Stackage:0.3.8.1, openSUSE:0.3.8.0 |
| Reverse Dependencies | 518 direct, 8034 indirect [details] |
| Downloads | 411723 total (205 in the last 30 days) |
| Rating | 2.25 (votes: 4) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs available [build log] Successful builds reported [all 1 reports] |