variable-precision-0.1.1: variable-precision floating point

Portabilityportable
Stabilityprovisional
Maintainerclaudiusmaximus@goto10.org
Safe HaskellSafe-Infered

Numeric.VariablePrecision.Precision

Description

Classes for types with precision represented by a type-level natural number, and variable precision types.

Note that performance may be (even) slow(er) with some versions of the type-level-natural-number package.

Synopsis

Documentation

class HasPrecision t whereSource

A class for types with precision. Minimal complete definition: (none).

Methods

precisionOf :: NaturalNumber p => t p -> pSource

Get the precision of a value. precisionOf must not evaluate its argument, and its result must not be evaluated.

precision :: (HasPrecision t, NaturalNumber p) => t p -> IntSource

Much like naturalNumberAsInt combined with precisionOf.

atPrecision :: (HasPrecision t, NaturalNumber p) => t p -> p -> t pSource

Much like const with a restricted type.

atPrecisionOf :: (HasPrecision t, HasPrecision s, NaturalNumber p) => t p -> s p -> t pSource

Much like const with a restricted type.

(.@) :: (HasPrecision t, HasPrecision s, NaturalNumber p) => t p -> s p -> t pSource

An alias for atPrecisionOf.

class HasPrecision t => VariablePrecision t whereSource

A class for types with variable precision. Minimal complete definition: (all).

Methods

adjustPrecision :: (NaturalNumber p, NaturalNumber q) => t p -> t qSource

Adjust the precision of a value preserving as much accuracy as possible.

withPrecision :: (VariablePrecision t, NaturalNumber p, NaturalNumber q) => t p -> q -> t qSource

Much like adjustPrecision combined with atPrecision.

withPrecisionOf :: (VariablePrecision t, HasPrecision s, NaturalNumber p, NaturalNumber q) => t p -> s q -> t qSource

Much like withPrecision combined with precisionOf.

(.@~) :: (VariablePrecision t, HasPrecision s, NaturalNumber p, NaturalNumber q) => t p -> s q -> t qSource

An alias for withPrecisionOf.