"Data.Scientific" provides the number type 'Scientific'. Scientific numbers are arbitrary precision and space efficient. They are represented using <http://en.wikipedia.org/wiki/Scientific_notation scientific notation>. The implementation uses a coefficient 'c :: 'Integer'' and a base-10 exponent 'e :: 'Int''. A scientific number corresponds to the 'Fractional' number: ''fromInteger' c * 10 '^^' e'.
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 to '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 over using 'Rational' for this are that:
constructed using '%' which has to compute the 'gcd' of the 'numerator' and 'denominator'.
'1e1000000000 :: 'Rational'' will fill up all space and crash your program. Scientific works as expected:
>>> read "1e1000000000" :: Scientific 1.0e1000000000
''Integral's' (like: 'Int') or ''RealFloat's' (like: 'Double' or 'Float') will always be bounded by the target type.
Package Version | Update ID | Released | Package Hub Version | Platforms | Subpackages |
---|---|---|---|---|---|
0.3.7.0-150500.3.3.2 info | SUSE-SLE-Module-Packagehub-Subpackages-15-SP5-2024-572 | 2024-02-21 | 15 SP5 Subpackages Updates |
|
|
0.3.7.0-bp154.2.11 info | GA Release | 2022-05-09 | 15 SP4 |
|
|
0.3.6.2-bp153.1.20 info | GA Release | 2021-04-08 | 15 SP3 |
|
|
0.3.6.2-bp152.4.15 info | GA Release | 2020-06-16 | 15 SP2 |
|
|
0.3.6.2-bp151.2.2 info | GA Release | 2019-07-17 | 15 SP1 |
|
|
0.3.6.2-bp151.1.10 info | GA Release | 2019-05-31 | 15 SP1 |
|
|
0.3.5.1-bp150.2.5 info | GA Release | 2018-07-31 | 15 |
|
|
0.3.5.1-bp150.2.4 info | GA Release | 2018-07-30 | 15 |
|
|
0.3.4.9-6.9 info | 5585 | 2016-09-14 | 12 GA-SP5 |
|
|
0.3.4.9-6.5 info | 5585 | 2016-09-14 | 12 GA-SP5 |
|
|
0.3.4.4-3.1 info | openSUSE-2016-291 | 2016-07-04 | 12 GA-SP5 |
|
|