| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Howl.Expr.Numeric
Description
Numeric types and conversions used by Howl expressions.
This module defines the Numeric datatype, together with
conversions to and from common Haskell numeric types and MPFR-based
arbitrary-precision floating-point numbers.
Synopsis
- data Numeric
- class FromNumeric a where
- fromNumeric :: Numeric -> Maybe a
- type BigFloat = Rounded
- type BigFloatPrecision = Precision
- fromBigFloat :: BigFloat -> Numeric
- toDouble :: Numeric -> Double
- toBigFloat :: BigFloatPrecision -> Numeric -> BigFloat
- bigFloatPrecision :: BigFloat -> BigFloatPrecision
Documentation
A numeric value.
Constructors
| NInteger !Integer | An integer. |
| NRational !Rational | A rational number. |
| NDouble !Double | A double-precision floating-point number. |
| NBigFloat !BigFloat | An MPFR floating-point number with dynamic precision. |
Instances
| Enum Numeric # | |
| Num Numeric # | |
| Fractional Numeric # | |
| Real Numeric # | |
Defined in Howl.Expr.Numeric Methods toRational :: Numeric -> Rational # | |
| RealFrac Numeric # | |
| Show Numeric # | |
| Eq Numeric # | |
| Ord Numeric # | |
| FromExpr Numeric # | |
| ToExpr Numeric # | |
Defined in Howl.Expr.Internal | |
| PPrint Numeric # | |
Defined in Howl.Expr.Numeric | |
class FromNumeric a where #
A class for extracting Haskell numeric values from a Numeric.
Methods
fromNumeric :: Numeric -> Maybe a #
Instances
| FromNumeric Rational # | |
Defined in Howl.Expr.Numeric Methods fromNumeric :: Numeric -> Maybe Rational # | |
| FromNumeric Integer # | |
Defined in Howl.Expr.Numeric Methods fromNumeric :: Numeric -> Maybe Integer # | |
| FromNumeric Double # | |
Defined in Howl.Expr.Numeric Methods fromNumeric :: Numeric -> Maybe Double # | |
| FromNumeric Int # | |
Defined in Howl.Expr.Numeric Methods fromNumeric :: Numeric -> Maybe Int # | |
type BigFloatPrecision = Precision #
The precision of a BigFloat.
toBigFloat :: BigFloatPrecision -> Numeric -> BigFloat #
bigFloatPrecision :: BigFloat -> BigFloatPrecision #
Get the precision of a BigFloat.