numeric types for a modern calculator with plenty of memory and CPU:
arbitrary precision integers
arbitrary precision rationals
arbitrary precision fixed point
arbitrary precision floating point
in arbitrary precision fixed point, the user chooses precision in advance and all calculations are done with that precision to the right of the decimal point. the integer part to the left of the decimal point is arbitrary precision integer. in arbitrary precision floating point, the mantissa has user-chosen precision (significant digits), and the exponent is arbitrary precision integer.
there will be the well known problem of operations that lose precision. maybe the data type keeps track of how much precision it actually has, in contrast to how much it started out with before operations that lost precision.
for the latter two types, we want various functions, e.g., exp, log, sqrt, trigonometric, special functions. maybe we want exp and log to convert between the last two.
Data.Scientific in Haskell provides a version of arbitrary precision floating point but does not provide extra functions. its stated mission is not to be a general numeric type but instead be a data type for safely parsing and storing floating point numbers with arbitrarily large exponents.
No comments :
Post a Comment