# Posted By

kosenko on 01/23/15

# Statistics

Viewed 322 times
Favorited by 0 user(s)

# Circa comparison of fractional numbers  This module provides a couple of functions and an operator to compare approximately fractional numbers.

Copy this code and paste it in your HTML
`module Circa (  circaEq,  picoEq, nanoEq, microEq, milliEq, centiEq, deciEq, uniEq,  (~=)  ) where circaEq :: (Fractional t, Ord t) => t -> t -> t -> BoolcircaEq t x y = abs (x - y) < t picoEq :: (Fractional t, Ord t) => t -> t -> BoolpicoEq = circaEq 1e-12infix 4 `picoEq` nanoEq :: (Fractional t, Ord t) => t -> t -> BoolnanoEq = circaEq 1e-9infix 4 `nanoEq` microEq :: (Fractional t, Ord t) => t -> t -> BoolmicroEq = circaEq 1e-6infix 4 `microEq` milliEq :: (Fractional t, Ord t) => t -> t -> BoolmilliEq = circaEq 1e-3infix 4 `milliEq` centiEq :: (Fractional t, Ord t) => t -> t -> BoolcentiEq = circaEq 1e-2infix 4 `centiEq` deciEq :: (Fractional t, Ord t) => t -> t -> BooldeciEq = circaEq 1e-1infix 4 `deciEq` uniEq :: (Fractional t, Ord t) => t -> t -> BooluniEq = circaEq 1infix 4 `uniEq` (~=) :: (Fractional t, Ord t) => t -> t -> Bool(~=) = picoEqinfix 4 ~=` Subscribe to comments