Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- data Dyadic = Integer :^ Int
- shiftD :: Int -> Dyadic -> Dyadic
- sqrtD :: Int -> Dyadic -> Dyadic
- sqrtD' :: Int -> Dyadic -> Dyadic -> Dyadic
- sqrtRecD :: Int -> Dyadic -> Dyadic
- sqrtRecD' :: Int -> Dyadic -> Dyadic -> Dyadic
- initSqrtRecD :: Dyadic -> Dyadic
- initSqrtRecDoubleD :: Dyadic -> Dyadic
- piMachinD :: Int -> Dyadic
- piBorweinD :: Int -> Dyadic
- ln2D :: Int -> Dyadic
- logD :: Int -> Dyadic -> Dyadic
- atanhD :: Int -> Dyadic -> Dyadic
- divD :: Dyadic -> Dyadic -> Dyadic
- divD' :: Int -> Dyadic -> Dyadic -> Dyadic

# Documentation

The Dyadic data type.

shiftD :: Int -> Dyadic -> Dyadic Source #

Shift a dyadic number to a given base and round in case of right shifts.

sqrtD :: Int -> Dyadic -> Dyadic Source #

Computes the square root of a Dyadic number to the specified base. The Newton-Raphson method may overestimates the square root, but the overestimate is bounded by 1 ulp. For example, sqrtD 0 2 will give 2, whereas the closest integer to the square root is 1. Need double precision to guarantee correct rounding, which was not considered worthwhile.

This is actually Heron's method and is no longer used in Approx as it is faster to use sqrtRecD.

sqrtD' :: Int -> Dyadic -> Dyadic -> Dyadic Source #

Square root with initial approximation as third argument.

sqrtRecD' :: Int -> Dyadic -> Dyadic -> Dyadic Source #

Reciprocal of square root using Newton's iteration with inital value as third argument.

initSqrtRecD :: Dyadic -> Dyadic Source #

Gives initial values for the iteration. Based on the three most significant bits of the argument. Should consider to use machine floating point to give initial value.

initSqrtRecDoubleD :: Dyadic -> Dyadic Source #

piBorweinD :: Int -> Dyadic Source #

Compute dyadic values close to pi by Borwein's formula.