Skip to content

HMath.Constants

Module index · Numerical conventions

Description

Constants with machine-readable provenance and uncertainty. Mathematical decimal literals carry an absolute truncation bound of 10^-50; conversion to Float/Double adds the target format's rounding error. Physical values are the CODATA 2022 adjustment (NIST SRD 121), not an unversioned latest-value promise.

On this page

API Purpose
piConstant The circle constant pi at the target Floating precision.
eConstant Euler number exp(1) at the target Floating precision.
tau One full turn in radians, 2*pi, at target Floating precision.
goldenRatio Golden ratio (1+sqrt 5)/2 at the target Floating precision.
eulerMascheroni Euler-Mascheroni constant from the stored 50-decimal-place literal, rounded to the chosen Floating type.
catalanConstant Catalan constant from a 50-decimal-place literal, rounded to the target Floating type; distinct from the integer Catalan-number sequence.
aperyConstant Apery constant zeta(3), from a 50-decimal-place literal rounded to the chosen Floating type.
sqrt2 Positive square root of two in the target Floating type.
sqrt3 Positive square root of three in the target Floating type.
ln2 Natural logarithm of two in the target Floating type.
ln10 Natural logarithm of ten in the target Floating type.
infinity Positive IEEE infinity (1/0) for a RealFloat type.
nan IEEE not-a-number (0/0) for a RealFloat type.
Constant Exact stored decimal Rational with name,unit,provenance,measurement uncertainty,and separate approximation bound. constantAs converts the value without its metadata.
Constant Declaration and type contract below.
constantName Human-readable name of this mathematical or physical constant.
constantValue Exact Rational representation of the stored decimal value; measurement/approximation uncertainties are separate fields.
standardUncertainty Absolute one-standard-deviation measurement uncertainty; zero for definitions.
approximationBound Absolute decimal truncation bound, separate from measurement uncertainty.
constantUnit Display unit string; mathematical dimensionless constants use 1.
constantSource Provenance URL and adjustment/definition identifier for the stored value.
constantAs Convert a Constant record's exact stored Rational decimal to the target Fractional type.
mathematicalConstants Catalog of mathematical constants with names, Rational decimal values, source URLs, and absolute decimal truncation bounds of 10^-50.
physicalConstants Catalog of supported physical constants, retaining unit, source, standard measurement uncertainty, and approximation-bound metadata.
speedOfLight Speed of light in vacuum: stored value 299792458 m s^-1, absolute standard uncertainty 0, from CODATA 2022.
planckConstant Planck constant: stored value 6.62607015e-34 J s, absolute standard uncertainty 0, from CODATA 2022.
elementaryCharge Elementary charge: stored value 1.602176634e-19 C, absolute standard uncertainty 0, from CODATA 2022.
boltzmannConstant Boltzmann constant: stored value 1.380649e-23 J K^-1, absolute standard uncertainty 0, from CODATA 2022.
avogadroConstant Avogadro constant: stored value 6.02214076e23 mol^-1, absolute standard uncertainty 0, from CODATA 2022.
gravitationalConstant Newtonian constant of gravitation: stored value 6.67430e-11 m^3 kg^-1 s^-2, absolute standard uncertainty 0.00015e-11, from CODATA 2022.
electronMass Electron mass: stored value 9.1093837139e-31 kg, absolute standard uncertainty 0.0000000028e-31, from CODATA 2022.
astronomicalUnit IAU 2012 exact astronomical unit: 149597870700 metres, with zero measurement uncertainty and approximation bound.
NumericLimits Format limits and precision metadata derived from RealFloat or the explicit 16-bit format definition.
NumericLimits Declaration and type contract below.
minimumNormal Smallest positive normal value of the represented floating format.
minimumSubnormal Smallest positive subnormal value of the represented floating format.
maximumFinite Largest finite positive value of the represented floating format.
machineEpsilon Gap between one and its next larger representable value.
significandDigits Number of radix digits in the floating significand.
minimumExponent Lower exponent bound returned by RealFloat.floatRange.
maximumExponent Upper exponent bound returned by RealFloat.floatRange.
numericLimits Derived from RealFloat radixdigitsrange, not hardcoded for Double.
integerLimits Given a bounded integral type witness, return its exact (minimum,maximum) as Integers.

Documentation

piConstant

piConstant :: Floating a => a Source #

The circle constant pi at the target Floating precision. Example: piConstant :: Double. For decimal provenance and an approximation bound, use mathematicalConstants.

eConstant

eConstant :: Floating a => a Source #

Euler number exp(1) at the target Floating precision. Use mathematicalConstants for rational decimal provenance.

tau

tau :: Floating a => a Source #

One full turn in radians, 2*pi, at target Floating precision.

goldenRatio

goldenRatio :: Floating a => a Source #

Golden ratio (1+sqrt 5)/2 at the target Floating precision.

eulerMascheroni

eulerMascheroni :: Floating a => a Source #

Euler-Mascheroni constant from the stored 50-decimal-place literal, rounded to the chosen Floating type. Provenance is in mathematicalConstants.

catalanConstant

catalanConstant :: Floating a => a Source #

Catalan constant from a 50-decimal-place literal, rounded to the target Floating type; distinct from the integer Catalan-number sequence.

aperyConstant

aperyConstant :: Floating a => a Source #

Apery constant zeta(3), from a 50-decimal-place literal rounded to the chosen Floating type.

sqrt2

sqrt2 :: Floating a => a Source #

Positive square root of two in the target Floating type.

sqrt3

sqrt3 :: Floating a => a Source #

Positive square root of three in the target Floating type.

ln2

ln2 :: Floating a => a Source #

Natural logarithm of two in the target Floating type.

ln10

ln10 :: Floating a => a Source #

Natural logarithm of ten in the target Floating type.

infinity

infinity :: RealFloat a => a Source #

Positive IEEE infinity (1/0) for a RealFloat type. This value is intentionally non-finite and is rejected by checked finite-input APIs.

nan

nan :: RealFloat a => a Source #

IEEE not-a-number (0/0) for a RealFloat type. NaN is not equal to itself; use isNaN to inspect it.

Constant

data Constant Source #

Exact stored decimal Rational with name,unit,provenance,measurement uncertainty,and separate approximation bound. constantAs converts the value without its metadata.

Constructors

Constant 

Fields

Instances

Instances details
Show Constant Source # 
Instance details

Defined in HMath.Constants

Eq Constant Source # 
Instance details

Defined in HMath.Constants

constantAs

constantAs :: Fractional a => Constant -> a Source #

Convert a Constant record's exact stored Rational decimal to the target Fractional type. The result omits its uncertainty metadata; retain the record when reporting measurements.

mathematicalConstants

mathematicalConstants :: [Constant] Source #

Catalog of mathematical constants with names, Rational decimal values, source URLs, and absolute decimal truncation bounds of 10^-50. Measurement uncertainties are zero; target Float/Double conversion adds rounding error.

physicalConstants

physicalConstants :: [Constant] Source #

Catalog of supported physical constants, retaining unit, source, standard measurement uncertainty, and approximation-bound metadata. Values use CODATA 2022 except the IAU-defined astronomical unit.

speedOfLight

speedOfLight :: Constant Source #

Speed of light in vacuum: stored value 299792458 m s^-1, absolute standard uncertainty 0, from CODATA 2022. Returns a Constant metadata record; use constantAs for a numeric conversion.

planckConstant

planckConstant :: Constant Source #

Planck constant: stored value 6.62607015e-34 J s, absolute standard uncertainty 0, from CODATA 2022. Returns a Constant metadata record; use constantAs for a numeric conversion.

elementaryCharge

elementaryCharge :: Constant Source #

Elementary charge: stored value 1.602176634e-19 C, absolute standard uncertainty 0, from CODATA 2022. Returns a Constant metadata record; use constantAs for a numeric conversion.

boltzmannConstant

boltzmannConstant :: Constant Source #

Boltzmann constant: stored value 1.380649e-23 J K^-1, absolute standard uncertainty 0, from CODATA 2022. Returns a Constant metadata record; use constantAs for a numeric conversion.

avogadroConstant

avogadroConstant :: Constant Source #

Avogadro constant: stored value 6.02214076e23 mol^-1, absolute standard uncertainty 0, from CODATA 2022. Returns a Constant metadata record; use constantAs for a numeric conversion.

gravitationalConstant

gravitationalConstant :: Constant Source #

Newtonian constant of gravitation: stored value 6.67430e-11 m^3 kg^-1 s^-2, absolute standard uncertainty 0.00015e-11, from CODATA 2022. Returns a Constant metadata record; use constantAs for a numeric conversion.

electronMass

electronMass :: Constant Source #

Electron mass: stored value 9.1093837139e-31 kg, absolute standard uncertainty 0.0000000028e-31, from CODATA 2022. Returns a Constant metadata record; use constantAs for a numeric conversion.

astronomicalUnit

astronomicalUnit :: Constant Source #

IAU 2012 exact astronomical unit: 149597870700 metres, with zero measurement uncertainty and approximation bound. Returns a Constant record with its source URL.

NumericLimits

data NumericLimits a Source #

Format limits and precision metadata derived from RealFloat or the explicit 16-bit format definition.

Constructors

NumericLimits 

Fields

Instances

Instances details
Show a => Show (NumericLimits a) Source # 
Instance details

Defined in HMath.Numeric

Eq a => Eq (NumericLimits a) Source # 
Instance details

Defined in HMath.Numeric

numericLimits

numericLimits :: RealFloat a => a -> NumericLimits a Source #

Derived from RealFloat radixdigitsrange, not hardcoded for Double.

integerLimits

integerLimits :: (Integral a, Bounded a) => a -> (Integer, Integer) Source #

Given a bounded integral type witness, return its exact (minimum,maximum) as Integers. The witness value is used only to select the type.