Copyright | (c) 2011 Daniel Fischer |
---|---|

License | MIT |

Maintainer | Daniel Fischer <daniel.is.fischer@googlemail.com> |

Safe Haskell | None |

Language | Haskell2010 |

Deprecated: Use Math.NumberTheory.Roots

Description: Deprecated

Functions dealing with fourth powers. Efficient calculation of integer fourth roots and efficient testing for being a square's square.

## Synopsis

- integerFourthRoot :: Integral a => a -> a
- integerFourthRoot' :: Integral a => a -> a
- exactFourthRoot :: Integral a => a -> Maybe a
- isFourthPower :: Integral a => a -> Bool
- isFourthPower' :: Integral a => a -> Bool
- isPossibleFourthPower :: Integral a => a -> Bool

# Documentation

integerFourthRoot :: Integral a => a -> a Source #

Calculate the integer fourth root of a nonnegative number,
that is, the largest integer `r`

with `r^4 <= n`

.
Throws an error on negaitve input.

integerFourthRoot' :: Integral a => a -> a Source #

Calculate the integer fourth root of a nonnegative number,
that is, the largest integer `r`

with `r^4 <= n`

.
The condition is *not* checked.

exactFourthRoot :: Integral a => a -> Maybe a Source #

Returns `Nothing`

if `n`

is not a fourth power,
`Just r`

if `n == r^4`

and `r >= 0`

.

isFourthPower :: Integral a => a -> Bool Source #

Test whether an integer is a fourth power. First nonnegativity is checked, then the unchecked test is called.

isFourthPower' :: Integral a => a -> Bool Source #

Test whether a nonnegative number is a fourth power.
The condition is *not* checked. If a number passes the
`isPossibleFourthPower`

test, its integer fourth root
is calculated.

isPossibleFourthPower :: Integral a => a -> Bool Source #

Test whether a nonnegative number is a possible fourth power.
The condition is *not* checked.
This eliminates about 99.958% of numbers.