variable-precision-0.4: variable-precision floating point

Portabilityportable
Stabilityunstable
Maintainerclaude@mathr.co.uk
Safe HaskellNone

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. The methods must not evaluate their arguments, and their results must not be evaluated. Minimal complete definition: (none).

Methods

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

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

Much like naturalNumberAsInt combined with precisionOf.

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

Much like const with a restricted type.

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

Much like const with a restricted type. Precedence between < and +.

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

An alias for atPrecisionOf. Precedence between < and +.

class HasPrecision t => VariablePrecision t whereSource

A class for types with adjustable precision. Minimal complete definition: adjustPrecision.

Methods

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

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

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

Much like adjustPrecision combined with atPrecision.

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

Much like withPrecision combined with precisionOf. Precedence between < and +.

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

An alias for withPrecisionOf. Precedence between < and +.

module Data.Word