howl-0.1.0.0: A small Wolfram Language interpreter and symbolic rewriting library
Safe HaskellNone
LanguageGHC2021

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

Documentation

data Numeric #

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

Instances details
Enum Numeric # 
Instance details

Defined in Howl.Expr.Numeric

Num Numeric # 
Instance details

Defined in Howl.Expr.Numeric

Fractional Numeric # 
Instance details

Defined in Howl.Expr.Numeric

Real Numeric # 
Instance details

Defined in Howl.Expr.Numeric

RealFrac Numeric # 
Instance details

Defined in Howl.Expr.Numeric

Methods

properFraction :: Integral b => Numeric -> (b, Numeric) #

truncate :: Integral b => Numeric -> b #

round :: Integral b => Numeric -> b #

ceiling :: Integral b => Numeric -> b #

floor :: Integral b => Numeric -> b #

Show Numeric # 
Instance details

Defined in Howl.Expr.Numeric

Eq Numeric # 
Instance details

Defined in Howl.Expr.Numeric

Methods

(==) :: Numeric -> Numeric -> Bool #

(/=) :: Numeric -> Numeric -> Bool #

Ord Numeric # 
Instance details

Defined in Howl.Expr.Numeric

FromExpr Numeric # 
Instance details

Defined in Howl.Expr.Internal

Methods

fromExpr :: Expr -> Maybe Numeric #

ToExpr Numeric # 
Instance details

Defined in Howl.Expr.Internal

Methods

toExpr :: Numeric -> Expr #

PPrint Numeric # 
Instance details

Defined in Howl.Expr.Numeric

Methods

pPrint :: Numeric -> String #

class FromNumeric a where #

A class for extracting Haskell numeric values from a Numeric.

Methods

fromNumeric :: Numeric -> Maybe a #

Instances

Instances details
FromNumeric Rational # 
Instance details

Defined in Howl.Expr.Numeric

FromNumeric Integer # 
Instance details

Defined in Howl.Expr.Numeric

FromNumeric Double # 
Instance details

Defined in Howl.Expr.Numeric

FromNumeric Int # 
Instance details

Defined in Howl.Expr.Numeric

type BigFloat = Rounded #

An arbitrary-precision floating-point number implemented using MPFR.

type BigFloatPrecision = Precision #

The precision of a BigFloat.

toDouble :: Numeric -> Double #

Convert a Numeric to a Double.

toBigFloat :: BigFloatPrecision -> Numeric -> BigFloat #

Convert a Numeric to a BigFloat with the given precision.