# Module poly

This module provides arithmetic multi precision functions. The
arithmetic expressions deci-mal/3, +/4, -/4, */4, //4 and ^/4
delegate to the module arith. The result of these expressions is
the unlimited operation rounded to the requested precision:

Examples:

?- X is mp((1001/1000)^99, 30).

X = 0d1.10401168603473323514396127584

?- X is mp(sqrt(2), 30).

X = 0d1.41421356237309504880168872422

The expression sqrt/3 is implemented by a range reduction and a Taylor series. The current implementation estimates the number of terms needed for the Taylor series and then applies a Horner schema. Speed and accuracy are not yet optimized.

The following multi precision expressions are defined:

**decimal(X, P, Y) (multi):**- The predicate succeeds in Y with decimal(X) for precision P.
**+(X, Y, P, Z) (multi):**- The predicate succeeds in Z with X+Y for precision P.
**-(X, Y, P, Z) (multi):**- The predicate succeeds in Z with X-Y for precision P.
***(X, Y, P, Z) (multi):**- The predicate succeeds in Z with X*Y for precision P.
**/(X, Y, P, Z) (multi):**- The predicate succeeds in Z with X/Y for precision P.
**^(X, Y, P, Z) (multi):**- The predicate succeeds in Z with X^Y for precision P.
**sqrt(X, P, Y) (multi):**- The predicate succeeds in Y with sqrt(X) for precision P.

## Comments