Safe Haskell | None |
---|

This module provides a type class `Quadratic`

, for solving
quadratic equations.

# Documentation

This type class provides a primitive method for solving quadratic
equations. For many floating-point or fixed-precision
representations of real numbers, using the usual "quadratic
formula" results in a significant loss of precision. Instances of
the `Quadratic`

class should provide an efficient high-precision
method when possible.

quadratic :: QRootTwo -> QRootTwo -> QRootTwo -> Maybe (a, a)Source

`qroottwo_quadratic`

*a* *b* *c*: solve the quadratic equation
*ax*² + *bx* + *c* = 0. Return the pair of solutions (*x*₁, *x*₂)
with *x*₁ ≤ *x*₂, or `Nothing`

if no solution exists. Note that
the coefficients *a*, *b*, and *c* are taken to be of an exact
type; therefore instances have the opportunity to work with
infinite precision.