-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Decimal floating point arithmetic -- -- deka provides decimal floating point arithmetic. It is based on the -- decNumber C library, which is available at -- -- http://speleotrove.com/decimal/decnumber.html -- -- decNumber, in turn, implements the General Decimal Arithmetic -- Specification, which is available at -- -- http://speleotrove.com/decimal/ -- -- For more on deka, please see the Github home page at -- -- https://github.com/massysett/deka @package deka @version 0.4.0.4 -- | Documentation for Deka. -- -- At the moment, documentation is scattered about. Some of it is in the -- main README.md, which is in the source code tree and is viewable in -- Github at -- -- http://github.com/massysett/deka/blob/master/README.md -- -- Of course much of it is in the Haddock comments in the source code -- itself. -- -- There is also a module here, Data.Deka.Docs.Examples. It is in -- literate Haskell and has many comments. Unfortunately Haddock does not -- play well with Literate Haskell. However, the style of the file would -- not play well with Haddock anyway so I'm not sure I would ever switch -- back to regular Haskell for that file. -- -- So if you link to the file from the Haddock docs, you will just get a -- blank page. Fortunately it is easily readable in Github: -- -- -- http://github.com/massysett/deka/blob/master/lib/Data/Deka/Docs/Examples.hs module Data.Deka.Docs -- | Floating-point decimals. -- -- This uses the decNumber C library, so you will want to read the -- documentation about it to fully understand this module: -- -- http://speleotrove.com/decimal/decnumber.html -- -- http://speleotrove.com/decimal/decarith.html -- -- http://speleotrove.com/decimal/ -- -- Many of the comments on what these functions do are taken directly -- from the documentation for the decNumber C library. -- -- In particular, this module implements the decQuad type. decQuad -- supports up to 34 digits of precision and exponents between -6176 and -- 6111. It doesn't silently round, overflow, or underflow; rather, the -- library will notify you if these things happen. -- -- Many functions in this module clash with Prelude names, so you might -- want to do -- --
--   import qualified Data.Deka.Quad as Q
--   
module Data.Deka.Quad -- | Decimal number. As indicated in the General Decimal Arithmetic -- specification, a Quad might be a finite number (perhaps the -- most common type) or it might be infinite or a not-a-number. -- decClass will tell you a little more about a particular -- Quad. data Quad data Round -- | Round toward positive infinity. roundCeiling :: Round -- | Round away from zero. roundUp :: Round -- | 0.5 rounds up roundHalfUp :: Round -- | 0.5 rounds to nearest even roundHalfEven :: Round -- | 0.5 rounds down roundHalfDown :: Round -- | Round toward zero - truncate roundDown :: Round -- | Round toward negative infinity. roundFloor :: Round -- | Round for reround round05Up :: Round -- | A single error or warning condition that may be set in the Ctx. data Flag -- | 0/0 is undefined. It sets this flag and returns a quiet NaN. divisionUndefined :: Flag -- | A non-zero dividend is divided by zero. Unlike 0/0, it has a -- defined result (a signed Infinity). divisionByZero :: Flag -- | Sometimes raised by divideInteger and remainder. divisionImpossible :: Flag -- | Raised on a variety of invalid operations, such as an attempt to use -- compareSignal on an operand that is an NaN. invalidOperation :: Flag -- | One or more non-zero coefficient digits were discarded during -- rounding. inexact :: Flag -- | A result is both subnormal and inexact. underflow :: Flag -- | The exponent of a result is too large to be represented. overflow :: Flag -- | A source string (for instance, in fromByteString) contained -- errors. conversionSyntax :: Flag -- | A container for multiple Flag indicating which are set and -- which are not. An instance of Exception so you can throw it if -- you want (no functions in this module throw.) data Flags unFlags :: Flags -> [Flag] setFlag :: Flag -> Flags -> Flags clearFlag :: Flag -> Flags -> Flags -- | Is this Flag set? checkFlag :: Flag -> Flags -> Bool -- | A Flags with no Flag set. emptyFlags :: Flags -- | The Ctx monad -- -- The General Decimal Arithmetic specification states that most -- computations occur within a context, which affects the manner -- in which computations are done (for instance, the context determines -- the rounding algorithm). The context also carries the flags that -- computations can set (for instance, a computation might set a flag to -- indicate that the result is rounded or inexact or was a division by -- zero.) The Ctx monad carries this context. data Ctx a -- | The current status flags, which indicate results from previous -- computations. getStatus :: Ctx Flags -- | Set the current status to whatever you wish. setStatus :: Flags -> Ctx () mapStatus :: (Flags -> Flags) -> Ctx () -- | The current rounding method getRound :: Ctx Round -- | Change the current rounding method setRound :: Round -> Ctx () -- | By default, rounding is set to roundHalfEven. No status flags -- are set initially. Returns the final status flags along with the -- result of the computation. runCtx :: Ctx a -> (a, Flags) -- | Like runCtx but does not return the final flags. evalCtx :: Ctx a -> a -- | Different categories of Quad. data DecClass -- | Signaling NaN sNan :: DecClass -- | Quiet NaN qNan :: DecClass -- | Negative infinity negInf :: DecClass -- | Negative normal number negNormal :: DecClass -- | Negative subnormal number negSubnormal :: DecClass -- | The negative zero negZero :: DecClass -- | The positive zero posZero :: DecClass -- | A positive subnormal number posSubnormal :: DecClass -- | A positive normal number posNormal :: DecClass -- | Positive infinity posInf :: DecClass -- | More information about a particular Quad. decClass :: Quad -> DecClass -- | Reads a ByteString, which can be in scientific, engineering, or -- "regular" decimal notation. Also reads NaN, Infinity, etc. Will return -- a signaling NaN and set invalidOperation if the string given is -- invalid. -- -- In the decNumber C library, this function was called -- fromString; the name was changed here because it doesn't take -- a regular Haskell String. fromByteString :: ByteString -> Ctx Quad -- | Converts a Quad to a string. May use non-scientific notation, -- but only if that's unambiguous; otherwise, uses scientific notation. -- -- In the decNumber C library, this is called toString; the name -- was changed here because this function doesn't return a Haskell -- String. toByteString :: Quad -> ByteString -- | Returns a string in engineering notation. -- -- In the decNumber C library, this is called toEngString; the -- name is changed here because the function does not return a regular -- Haskell String. toEngByteString :: Quad -> ByteString type C'int32_t = Int32 type C'uint32_t = Word32 fromInt32 :: C'int32_t -> Quad fromUInt32 :: C'uint32_t -> Quad -- | Uses the rounding method given rather than the one in the Ctx. -- If the operand is infinite, an NaN, or if the result of rounding is -- outside the range of a C'int32_t, then invalidOperation -- is set. inexact is not set even if rounding occurred. toInt32 :: Round -> Quad -> Ctx C'int32_t -- | Like toInt32 but if rounding removes non-zero digits then -- inexact is set. toInt32Exact :: Round -> Quad -> Ctx C'int32_t -- | toUInt32 r x returns the value of x, rounded to an -- integer if necessary using the rounding mode r rather than -- the one given in the Ctx. If x is infinite, or outside -- of the range of a C'uint32_t, then invalidOperation is -- set. inexact is not set even if rounding occurs. -- -- The negative zero converts to 0 and is valid, but negative numbers are -- not valid. toUInt32 :: Round -> Quad -> Ctx C'uint32_t -- | Same as toUInt32 but if rounding removes non-zero digits then -- inexact is set. toUInt32Exact :: Round -> Quad -> Ctx C'uint32_t add :: Quad -> Quad -> Ctx Quad subtract :: Quad -> Quad -> Ctx Quad multiply :: Quad -> Quad -> Ctx Quad -- | Fused multiply add; fma x y z calculates x * y + z. -- The multiply is carried out first and is exact, so the result has only -- one final rounding. fma :: Quad -> Quad -> Quad -> Ctx Quad divide :: Quad -> Quad -> Ctx Quad -- | divideInteger x y returns the integer part of the result -- (rounded toward zero), with an exponent of 0. If the the result would -- not fit because it has too many digits, divisionImpossible is -- set. divideInteger :: Quad -> Quad -> Ctx Quad -- | Remainder from integer division. If the intermediate integer does not -- fit within a Quad, divisionImpossible is raised. remainder :: Quad -> Quad -> Ctx Quad -- | Like remainder but the nearest integer is used for for the -- intermediate result instead of the result from divideInteger. remainderNear :: Quad -> Quad -> Ctx Quad -- | quantize x y returns z which is x set to -- have the same quantum as y; that is, numerically the same -- value but rounded or padded if necessary to have the same exponent as -- y. Useful for rounding monetary quantities. quantize :: Quad -> Quad -> Ctx Quad -- | Reduces coefficient to its shortest possible form without changing the -- value of the result by removing all possible trailing zeroes. reduce :: Quad -> Ctx Quad -- | Compares two Quad numerically. The result might be -1, -- 0, 1, or NaN, where -1 means x is less than -- y, 0 indicates numerical equality, 1 means y is -- greater than x. NaN is returned only if x or y is an NaN. -- -- Thus, this function does not return an Ordering because the -- result might be an NaN. compare :: Quad -> Quad -> Ctx Quad -- | Wrapper for compare that returns an Ordering rather than -- a Quad. Returns Just LT rather than -1, Just -- EQ rather than 0, and Just GT rather than 1, and -- Nothing rather than NaN. This is a pure function; it does not -- affect the Ctx. compareOrd :: Quad -> Quad -> Maybe Ordering -- | Same as compare, but a quietNaN is treated like a signaling NaN -- (sets invalidOperation). compareSignal :: Quad -> Quad -> Ctx Quad -- | Compares using an IEEE 754 total ordering, which takes into account -- the exponent. IEEE 754 says that this function might return different -- results depending upon whether the operands are canonical; Quad -- are always canonical so you don't need to worry about that here. compareTotal :: Quad -> Quad -> Ordering -- | Same as compareTotal but compares the absolute value of the two -- arguments. compareTotalMag :: Quad -> Quad -> Ordering -- | max x y returns the larger argument; if either (but not both) -- x or y is a quiet NaN then the other argument is the -- result; otherwise, NaNs, are handled as for arithmetic operations. max :: Quad -> Quad -> Ctx Quad -- | Like max but the absolute values of the arguments are used. maxMag :: Quad -> Quad -> Ctx Quad -- | min x y returns the smaller argument; if either (but not -- both) x or y is a quiet NaN then the other argument -- is the result; otherwise, NaNs, are handled as for arithmetic -- operations. min :: Quad -> Quad -> Ctx Quad -- | Like min but the absolute values of the arguments are used. minMag :: Quad -> Quad -> Ctx Quad -- | True only if both operands have the same exponent or are both NaNs -- (quiet or signaling) or both infinite. sameQuantum :: Quad -> Quad -> Bool -- | True if x is neither infinite nor a NaN. isFinite :: Quad -> Bool -- | True for infinities. isInfinite :: Quad -> Bool -- | True if x is finite and has exponent of 0; False -- otherwise. This tests the exponent, not the adjusted exponent. -- This can lead to results you may not expect: -- --
--   >>> isInteger . evalCtx . fromByteString . pack $ "3.00e2"
--   True
--   
-- --
--   >>> isInteger . evalCtx . fromByteString . pack $ "3e2"
--   False
--   
-- --
--   >>> isInteger . evalCtx . fromByteString . pack $ "3.00e0"
--   False
--   
isInteger :: Quad -> Bool -- | True only if x is zero or positive, an integer (finite with -- exponent of 0), and the coefficient is only zeroes and/or ones. isLogical :: Quad -> Bool -- | True for NaNs. isNaN :: Quad -> Bool -- | True only if x is less than zero and is not an NaN. isNegative :: Quad -> Bool -- | True only if x is finite, non-zero, and not subnormal. isNormal :: Quad -> Bool -- | True only if x is greater than zero and is not an NaN. isPositive :: Quad -> Bool -- | True only if x is a signaling NaN. isSignaling :: Quad -> Bool -- | True only if x has a sign of 1. Note that zeroes and NaNs may -- have sign of 1. isSigned :: Quad -> Bool -- | True only if x is subnormal - that is, finite, non-zero, and -- with a magnitude less than 10 ^ emin. isSubnormal :: Quad -> Bool -- | True only if x is a zero. isZero :: Quad -> Bool -- | Same effect as 0 + x where the exponent of the zero is the -- same as that of x if x is finite). NaNs are handled -- as for arithmetic operations. plus :: Quad -> Ctx Quad -- | Negation. Result has the same effect as 0 - x when the -- exponent of the zero is the same as that of x, if x -- is finite. minus :: Quad -> Ctx Quad -- | Absolute value. NaNs are handled normally (the sign of an NaN is not -- affected, and an sNaN sets invalidOperation. abs :: Quad -> Ctx Quad -- | copySign x y returns z, which is a copy of -- x but has the sign of y. This function never raises -- any signals. copySign :: Quad -> Quad -> Quad -- | Decrements toward negative infinity. nextMinus :: Quad -> Ctx Quad -- | Increments toward positive infinity. nextPlus :: Quad -> Ctx Quad -- | nextToward x y returns the next Quad in the direction -- of y. nextToward :: Quad -> Quad -> Ctx Quad -- | Digit-wise logical and. Operands must be: -- -- -- -- If not, invalidOperation is set. and :: Quad -> Quad -> Ctx Quad -- | Digit wise logical inclusive Or. Operands must be: -- -- -- -- If not, invalidOperation is set. or :: Quad -> Quad -> Ctx Quad -- | Digit-wise logical exclusive or. Operands must be: -- -- -- -- If not, invalidOperation is set. xor :: Quad -> Quad -> Ctx Quad -- | Digit-wise logical inversion. The operand must be: -- -- -- -- If not, invalidOperation is set. invert :: Quad -> Ctx Quad -- | shift x y shifts digits the digits of x to the left (if -- y is positive) or right (if y is negative) without -- adjusting the exponent or sign of x. Any digits shifted in -- from the left or right will be 0. -- -- y is a count of positions to shift; it must be a finite -- integer in the range negate coefficientLen to -- coefficientLen. NaNs propagate as usual. If x is -- infinite the result is an infinity of the same sign. No status is set -- unless y is invalid or the operand is an NaN. shift :: Quad -> Quad -> Ctx Quad -- | rotate x y rotates the digits of x to the left (if y -- is positive) or right (if y is negative) without adjusting -- the exponent or sign of x. y is the number of -- positions to rotate and must be in the range negate -- coefficientLen to coefficentLen. -- -- NaNs are propagated as usual. No status is set unless y is -- invalid or an operand is an NaN. rotate :: Quad -> Quad -> Ctx Quad -- | logB x Returns the adjusted exponent of x, according to IEEE -- 754 rules. If x is infinite, returns +Infinity. If x -- is zero, the result is -Infinity, and divisionByZero is set. If -- x is less than zero, the absolute value of x is -- used. If x is one, the result is 0. NaNs are propagated as -- for arithmetic operations. logB :: Quad -> Ctx Quad -- | scaleB x y calculates x * 10 ^ y. y must be -- an integer (finite with exponent of 0) in the range of plus or minus -- 2 * coefficientLen + coefficientLen), typically -- resulting from logB. Underflow and overflow might occur; NaNs -- propagate as usual. scaleB :: Quad -> Quad -> Ctx Quad -- | Number of significant digits. If zero or infinite, returns 1. If NaN, -- returns number of digits in the payload. digits :: Quad -> Int -- | Rounds to an integral using the rounding mode set in the Ctx. -- If the operand is infinite, an infinity of the same sign is returned. -- If the operand is an NaN, the result is the same as for other -- arithmetic operations. If rounding removes non-zero digits then -- inexact is set. toIntegralExact :: Quad -> Ctx Quad -- | toIntegralValue r x returns an integral value of x -- using the rounding mode r rather than the one specified in -- the Ctx. If the operand is an NaN, the result is the same as -- for other arithmetic operations. inexact is not set even if -- rounding occurred. toIntegralValue :: Round -> Quad -> Ctx Quad -- | A Quad whose coefficient, exponent, and sign are all 0. zero :: Quad -- | A Quad with coefficient D1, exponent 0, and sign Sign0. one :: Quad -- | Identifies the version of the decNumber C library. version :: ByteString -- | A single decimal digit. data Digit D0 :: Digit D1 :: Digit D2 :: Digit D3 :: Digit D4 :: Digit D5 :: Digit D6 :: Digit D7 :: Digit D8 :: Digit D9 :: Digit digitToInt :: Integral a => Digit -> a intToDigit :: Integral a => a -> Digit digitToChar :: Digit -> Char -- | The most significant digit is at the head of the list. digitsToInteger :: [Digit] -> Integer -- | The most significant digit is at the head of the list. Sign of number -- is not relevant. integralToDigits :: Integral a => a -> [Digit] -- | Maximum number of digits in a coefficient. coefficientLen :: Int -- | Maximum number of digits in a payload. payloadLen :: Int -- | A list of digits, less than or equal to coefficientLen long. -- Corresponds only to finite numbers. data Coefficient -- | Creates a Coefficient. Checks to ensure it is not null and that -- it is not longer than coefficientLen and that it does not have -- leading zeroes (if it is 0, a single D0 is allowed). coefficient :: [Digit] -> Maybe Coefficient unCoefficient :: Coefficient -> [Digit] -- | Coefficient of D0 zeroCoefficient :: Coefficient -- | Coefficient of D1 oneCoefficient :: Coefficient -- | A list of digits, less than or equal to payloadLen long. -- Accompanies an NaN, potentially with diagnostic information (I do not -- know if decNumber actually makes use of this.) data Payload -- | Creates a Payload. Checks to ensure it is not null, not longer -- than payloadLen and that it does not have leading zeroes (if it -- is 0, a single D0 is allowed). payload :: [Digit] -> Maybe Payload unPayload :: Payload -> [Digit] -- | Payload of [D0] zeroPayload :: Payload -- | The signed integer which indicates the power of ten by which the -- coefficient is multiplied. data Exponent -- | Ensures that the exponent is within the range allowed by -- minMaxExp. exponent :: Int -> Maybe Exponent unExponent :: Exponent -> Int -- | An Exponent whose value is 0. zeroExponent :: Exponent -- | The minimum and maximum possible exponent. minMaxExp :: (Int, Int) -- | An adjusted exponent is the value of an exponent of a number when that -- number is expressed as though in scientific notation with one digit -- before any decimal point. This is the finite exponent + (number of -- significant digits - 1). data AdjustedExp adjustedExp :: Coefficient -> Exponent -> AdjustedExp unAdjustedExp :: AdjustedExp -> Int -- | The smallest possible adjusted exponent that is still normal. Adjusted -- exponents smaller than this are subnormal. minNormalAdj :: AdjustedExp -- | Like minNormalAdj, but returns the size of the regular exponent -- rather than the adjusted exponent. minNormalExp :: Coefficient -> Exponent adjustedToExponent :: Coefficient -> AdjustedExp -> Exponent data Sign -- | The number is positive or is zero Sign0 :: Sign -- | The number is negative or the negative zero Sign1 :: Sign data NaN Quiet :: NaN Signaling :: NaN data Value Finite :: Coefficient -> Exponent -> Value Infinite :: Value NaN :: NaN -> Payload -> Value -- | A pure Haskell type which holds information identical to that in a -- Quad. data Decoded Decoded :: Sign -> Value -> Decoded dSign :: Decoded -> Sign dValue :: Decoded -> Value -- | Encodes a new Quad. fromBCD :: Decoded -> Quad -- | Decodes a Quad to a pure Haskell type which holds identical -- information. toBCD :: Quad -> Decoded -- | Converts a Decoded to scientific notation. Unlike toByteString -- this will always use scientific notation. For NaNs and infinities, the -- notation is identical to that of decNumber (see Decimal Arithmetic -- Specification page 19). This means that a quiet NaN is NaN -- while a signaling NaN is sNaN, and infinity is -- Infinity. -- -- Like decQuadToString, the payload of an NaN is not shown if it is -- zero. scientific :: Decoded -> String -- | Converts Decoded to ordinary decimal notation. For NaNs and -- infinities, the notation is identical to that of scientific. -- Unlike scientific, though the result can always be converted -- back to a Quad using fromByteString, the number of -- significant digits might change. For example, though 1.2E3 -- has two significant digits, using ordinary on this value and -- then reading it back in with fromByteString will give you -- 1200E0, which has four significant digits. ordinary :: Decoded -> String -- | Converts a Decoded to a Rational. Returns Nothing if the Decoded is -- not finite. decodedToRational :: Decoded -> Maybe Rational dIsFinite :: Decoded -> Bool dIsInfinite :: Decoded -> Bool dIsInteger :: Decoded -> Bool -- | True only if x is zero or positive, an integer (finite with -- exponent of 0), and the coefficient is only zeroes and/or ones. The -- sign must be Sign0 (that is, you cannot have a negative zero.) dIsLogical :: Decoded -> Bool dIsNaN :: Decoded -> Bool -- | True only if x is less than zero and is not an NaN. It's not -- enough for the sign to be Sign1; the coefficient (if finite) must be -- greater than zero. dIsNegative :: Decoded -> Bool dIsNormal :: Decoded -> Bool dIsPositive :: Decoded -> Bool dIsSignaling :: Decoded -> Bool dIsSigned :: Decoded -> Bool dIsSubnormal :: Decoded -> Bool -- | True for any zero (negative or positive zero). dIsZero :: Decoded -> Bool -- | The number of significant digits. Zero returns 1. dDigits :: Coefficient -> Int dIsSNaN :: Decoded -> Bool dIsQNaN :: Decoded -> Bool dIsNegInf :: Decoded -> Bool dIsNegNormal :: Decoded -> Bool dIsNegSubnormal :: Decoded -> Bool dIsNegZero :: Decoded -> Bool dIsPosZero :: Decoded -> Bool dIsPosSubnormal :: Decoded -> Bool dIsPosNormal :: Decoded -> Bool dIsPosInf :: Decoded -> Bool instance Typeable Flags instance Eq Round instance Ord Round instance Eq Flag instance Ord Flag instance Eq Flags instance Ord Flags instance Eq DecClass instance Ord DecClass instance Eq Sign instance Ord Sign instance Show Sign instance Enum Sign instance Bounded Sign instance Eq NaN instance Ord NaN instance Show NaN instance Enum NaN instance Bounded NaN instance Eq Exponent instance Ord Exponent instance Show Exponent instance Eq Digit instance Ord Digit instance Show Digit instance Enum Digit instance Bounded Digit instance Eq Coefficient instance Ord Coefficient instance Show Coefficient instance Eq Payload instance Ord Payload instance Show Payload instance Eq Value instance Ord Value instance Show Value instance Eq Decoded instance Ord Decoded instance Show Decoded instance Eq AdjustedExp instance Show AdjustedExp instance Ord AdjustedExp instance Enum AdjustedExp instance Bounded AdjustedExp instance Enum Payload instance Bounded Payload instance Enum Coefficient instance Bounded Coefficient instance Enum Exponent instance Bounded Exponent instance Show DecClass instance Show Flags instance Exception Flags instance Show Flag instance Show Round -- | Simple decimal arithmetic. -- -- Deka provides a decimal arithmetic type. You are limited to 34 -- digits of precision. That's 34 digits total, not 34 digits after the -- decimal point. For example, the numbers 123.0 and -- 0.1230 both have four digits of precision. Deka remembers -- significant digits, so 123 has three digits of precision -- while 123.0 has four digits of precision. -- -- Using this module, the results are never inexact. Computations will -- throw exceptions rather than returning an inexact result. That way, -- you know that any result you have is exactly correct. -- -- Deka represents only finite values. There are no infinities or -- not-a-number values allowed. -- -- For more control over your arithmetic, see Data.Deka.Quad, but -- for many routine uses this module is sufficient and is more succinct -- because, unlike Quad, Deka is a member of the Num -- typeclass. module Data.Deka -- | Deka wraps a Quad. Only finite Quad may become a -- Deka; no infinities or NaN values are allowed. -- -- Deka is a member of Num and Real, making it easy -- to use for elementary arithmetic. Any time you perform arithmetic, the -- results are always exact. The arithmetic functions will throw -- exceptions rather than give you an inexact result. -- -- Deka is not a member Fractional because it is generally -- impossible to perform division without getting inexact results, and -- Deka never holds inexact results. data Deka unDeka :: Deka -> Quad -- | Decimals with a total ordering. newtype DekaT DekaT :: Deka -> DekaT unDekaT :: DekaT -> Deka -- | Convert any integral to a Deka. Returns Nothing if the integer -- is too big to fit into a Deka (34 digits). integralToDeka :: Integral a => a -> Maybe Deka -- | Convert a string to a Deka. You can use ordinary numeric strings, such -- as 3.25, or exponential notation, like 325E-2. More -- information on your choices is at: -- -- http://speleotrove.com/decimal/daconvs.html#reftonum -- -- You cannot use strings that represent an NaN or an infinity. If you do -- that, or use an otherwise invalid string, this function returns -- Nothing. strToDeka :: String -> Maybe Deka -- | Change a Quad to a Deka. Only succeeds for finite Quad. quadToDeka :: Quad -> Maybe Deka -- | Thrown by arithmetic functions in the Num class, as this is the only -- way to indicate errors. data DekaError -- | Could not convert an integer to a Deka; it is too big. IntegerTooBig :: Integer -> DekaError -- | A computation set flags. This will happen if, for example, you -- calculate a result that is out of range, such as -- --
--   >>> maxBound + maxBound :: Deka
--   
Flagged :: Flags -> DekaError instance [safe] Typeable DekaError instance [safe] Show DekaError instance [safe] Show Deka instance [safe] Show DekaT instance [safe] Ord DekaT instance [safe] Eq DekaT instance [safe] Bounded Deka instance [safe] Real Deka instance [safe] Num Deka instance [safe] Ord Deka instance [safe] Eq Deka instance [safe] Exception DekaError -- | If you are viewing this module in Haddock and expecting to see -- examples, you won't see anything. The file is written in literate -- Haskell, so the idea is that you will look at the source itself. You -- can look at the source in Haddock, but it will probably be poorly -- formatted because HsColour formats it rather oddly by default. The -- easiest way to see it is on Github: -- -- -- https://github.com/massysett/deka/blob/master/lib/Data/Deka/Docs/Examples.lhs module Data.Deka.Docs.Examples examples :: IO ()