Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- threeDigitsK :: Double -> Double
- type ErrorImpact = Int
- absErr2Frac :: Double -> Double -> Double
- errImpact :: Integral a => ErrorImpact -> Double -> a
- absErr2FracI :: ErrorImpact -> Double -> Double -> Double
- absErrUDecomp3 :: [Double] -> Double -> Double
- absErrUDecomp3I :: ErrorImpact -> [Double] -> Double -> Double
- elemSolution2 :: Integral a => Int -> a -> Double -> Bool
- elemSolution2I :: Integral a => ErrorImpact -> a -> Double -> Bool
- setOfSolutionsGmin :: ErrorImpact -> Double -> (Double, Double)
- setOfSolutionsGmin3 :: Integral a => ErrorImpact -> a -> Double -> (Double, Double)
- suitable2 :: Double -> (Double, Double)
- suitable21G :: ErrorImpact -> Double -> Maybe ([Double], Double)
- suitable21G3 :: Integral a => ErrorImpact -> a -> Double -> Maybe ([Double], Double)
- suitable21 :: Double -> Maybe ([Double], Double)
- isRangeN :: Double -> Bool
- isRangeNPref :: Double -> Bool
- check1FracDecompG :: ErrorImpact -> Double -> Maybe ([Double], Double)
- check3FracDecompPartialG :: ErrorImpact -> Double -> Maybe ([Double], Double)
- check3FracDecompPartialPG :: ErrorImpact -> [Int] -> Double -> Maybe ([Double], Double)
- check3FracDecompPartialPG3 :: ErrorImpact -> [Int] -> Double -> Maybe ([Double], Double)
- lessErrSimpleDecompPG :: ErrorImpact -> [Int] -> Double -> (Int, Maybe ([Double], Double), Double)
- lessErrDenomsPG :: ErrorImpact -> [Int] -> Double -> [Integer]
- check1FracDecomp :: Double -> Maybe ([Double], Double)
- check3FracDecompPartial :: Double -> Maybe ([Double], Double)
- check3FracDecompPartialP :: [Int] -> Double -> Maybe ([Double], Double)
- lessErrSimpleDecompP :: [Int] -> Double -> (Int, Maybe ([Double], Double), Double)
- lessErrDenomsP :: [Int] -> Double -> [Integer]
- lessErrSimpleDecomp4PG :: ErrorImpact -> [Int] -> Double -> ([Integer], Double)
- lessErrSimpleDecomp5PG :: ErrorImpact -> [Int] -> Double -> ([Integer], Double)
Documentation
threeDigitsK :: Double -> Double Source #
Rounding to thousandth.
type ErrorImpact = Int Source #
Characterizes the impact of the absolute error sign on the approximation.
absErr2Frac :: Double -> Double -> Double Source #
Absolute error with sign for the two unit fractions approximations and the first argument
(a in the related paper) being taken as the second parameter for the function.
The second argument here is expected to be fromIntegral
a0
where elem
a0
[2..] ==
True
.
absErr2FracI :: ErrorImpact -> Double -> Double -> Double Source #
A generalization of the absErr2Frac
with the possibility to check the sign.
absErrUDecomp3I :: ErrorImpact -> [Double] -> Double -> Double Source #
elemSolution2I :: Integral a => ErrorImpact -> a -> Double -> Bool Source #
setOfSolutionsGmin :: ErrorImpact -> Double -> (Double, Double) Source #
Searches for the minimum absolute error solution to two unit fractions decomposition
(approximation) for the fraction in the isRangeN
True
values with taking into account
the sign of the absolute error.
If the ErrorImpact
parameter is equal to 0 , then absolute error can be of any sign,
otherwise the sign of it is the same as the sign of the ErrorImpact
argument.
setOfSolutionsGmin3 :: Integral a => ErrorImpact -> a -> Double -> (Double, Double) Source #
A variant of setOfSolutionsGmin
where possible Integral
values are not equal to the second argument.
suitable21G :: ErrorImpact -> Double -> Maybe ([Double], Double) Source #
Allows to take into account the sign of the absolute error of the aproximation. If the
ErrorImpact
parameter is equal to 0 , then absolute error can be of any sign,
otherwise the sign of it is the same as the sign of the ErrorImpact
argument.
suitable21G3 :: Integral a => ErrorImpact -> a -> Double -> Maybe ([Double], Double) Source #
A variant of suitable21G
where possible Integral
values are not equal to the second argument.
isRangeNPref :: Double -> Bool Source #
The preferable range of the argument for suitable2
and suitable21
functions. For arguments
in this range the functions always have informative results.
check1FracDecompG :: ErrorImpact -> Double -> Maybe ([Double], Double) Source #
Allows to take into account the sign of the absolute error of the aproximation. If the
ErrorImpact
parameter is equal to 0 , then absolute error can be of any sign,
otherwise the sign of it is the same as the sign of the ErrorImpact
argument.
check3FracDecompPartialG :: ErrorImpact -> Double -> Maybe ([Double], Double) Source #
Allows to take into account the sign of the absolute error of the aproximation. If the
ErrorImpact
parameter is equal to 0 , then absolute error can be of any sign,
otherwise the sign of it is the same as the sign of the ErrorImpact
argument.
check3FracDecompPartialPG :: ErrorImpact -> [Int] -> Double -> Maybe ([Double], Double) Source #
Allows to take into account the sign of the absolute error of the aproximation. If the
ErrorImpact
parameter is equal to 0 , then absolute error can be of any sign,
otherwise the sign of it is the same as the sign of the ErrorImpact
argument.
check3FracDecompPartialPG3 :: ErrorImpact -> [Int] -> Double -> Maybe ([Double], Double) Source #
A variant of check3FracDecompPartialPG
where there is no possible equal Integral
values as
the result.
lessErrSimpleDecompPG :: ErrorImpact -> [Int] -> Double -> (Int, Maybe ([Double], Double), Double) Source #
Allows to take into account the sign of the absolute error of the aproximation. If the
ErrorImpact
parameter is equal to 0 , then absolute error can be of any sign,
otherwise the sign of it is the same as the sign of the ErrorImpact
argument.
lessErrDenomsPG :: ErrorImpact -> [Int] -> Double -> [Integer] Source #
Allows to take into account the sign of the absolute error of the aproximation. If the
ErrorImpact
parameter is equal to 0 , then absolute error can be of any sign,
otherwise the sign of it is the same as the sign of the ErrorImpact
argument.
check1FracDecomp :: Double -> Maybe ([Double], Double) Source #
Tries to approximate the fraction by just one unit fraction. Can be used for the numbers between 0.005 and 0.501.
check3FracDecompPartial :: Double -> Maybe ([Double], Double) Source #
Function to find the less by absolute value error approximation. One of the denominators is
taken from the range [2..10]. The two others are taken from the appropriate suitable21
applicattion.
check3FracDecompPartialP :: [Int] -> Double -> Maybe ([Double], Double) Source #
Extended version of the check3FracDecompPartial
with the first denominator being taken not
- only from the [2..10], but also from the custom user provided list.
-
lessErrDenomsP :: [Int] -> Double -> [Integer] Source #
Returns a list of denominators for fraction decomposition using also those ones from the the list provided as the first argument. Searches for the least error from the checked ones.
lessErrSimpleDecomp4PG :: ErrorImpact -> [Int] -> Double -> ([Integer], Double) Source #
Returns a unit fraction decomposition into 4 unit fractions. For the cases where the fraction
can be represented as a sum of three or less unit fractions, the last element in the resulting
list is really related to the floating-point arithmetic rounding errors and it depends on the
machine architecture and the realization of the floating-point arithmetic operations.
Almost any Double
value inside the [0.005, 2/3] can be rather well approximated by the sum of 4
unit fractions from the function here. There are also some intervals in the (2/3, 1] that have
also good approximations, though not every fraction is approximated well here.
lessErrSimpleDecomp5PG :: ErrorImpact -> [Int] -> Double -> ([Integer], Double) Source #
Returns a unit fraction decomposition into 5 unit fractions. For the cases where the fraction
can be represented as a sum of three or less unit fractions, the last element(s) in the resulting
list is (are) really related to the floating-point arithmetic rounding errors and it depends on the
machine architecture and the realization of the floating-point arithmetic operations.
Almost any Double
value inside the [0.005, 2/3] can be rather well approximated by the sum of 5
unit fractions from the function here. There are also some intervals in the (2/3, 1] that have
also good approximations, though not every fraction is approximated well here.