Safe Haskell | None |
---|---|
Language | Haskell2010 |
Technique.Quantity
Synopsis
- data Quantity
- data Decimal = Decimal Int64 Int8
- type Magnitude = Int8
- decimalToRope :: Decimal -> Rope
- isZeroDecimal :: Decimal -> Bool
- negateDecimal :: Decimal -> Decimal
- type Symbol = Rope
- data Unit = Unit {
- unitName :: Rope
- unitPlural :: Rope
- unitSymbol :: Rope
- unitGroup :: Group
- data Group
- = Metric
- | Time
- | Normal
- | Scientific
- | Engineering
- data Prefix = Prefix {
- prefixName :: Rope
- prefixSymbol :: Symbol
- prefixScale :: Int
- units :: Map Symbol Unit
- prefixes :: Map Symbol Prefix
Documentation
A decimal number with a fixed point resolution. The resolution (number of decimal places) is arbitrary within the available range. This isn't really for numerical analysis. It is for carrying information.
Implementation note
Internally this is a floating point where the mantissa is 19 characters wide (the width of a 64-bit int in base 10). Thus the biggest number representable is 9223372036854775807 and the smallest is 0.0000000000000000001. We could change this to Integer and be arbitrary precision but meh.
decimalToRope :: Decimal -> Rope Source #
isZeroDecimal :: Decimal -> Bool Source #
negateDecimal :: Decimal -> Decimal Source #
Constructors
Unit | |
Fields
|
Whether Système International metric prefixes can be used, or (as is the case of time units) quantities should not be aggregated to other scales.
Constructors
Metric | |
Time | |
Normal | |
Scientific | |
Engineering |
Constructors
Prefix | |
Fields
|