| Home | | | Quick start | | | Cookbook | | | All symbols | | | Analytical index | | | Namespaces | | | Syntax | | | Statements | | | CX | | | Frequency | | | Functions | | | Examples | | | Examples by command |
The AP. namespace exposes high-precision decimal/integer arithmetic through MAPM while keeping it outside normal Basic expressions. AP variables live in their own table; normal code accesses them through explicit bridges such as AP.STR("name") and AP.DOUBLE("name").
AP.EVAL, AP.SUM or AP.PROD, print/export using AP.STR or AP.FIXED, and convert to double only when precision loss is acceptable.AP.PRECISION 160
AP.SET a, "0.1"
AP.SET b, "0.2"
AP.ADD c, a, b
PRINT "AP command result: "; AP.STR("c", 80)
AP.EVAL y, "sin(pi/7)^2 + cos(pi/7)^2"
PRINT "AP.EVAL identity: "; AP.STR("y", 120)
AP.SUM eApprox, k, 0, 80, "1 / fact(k)"
PRINT "AP.SUM e approximation: "; AP.STR("eApprox", 100)
x = 0.1 + 0.2
PRINT "DOUBLE result: "; xAP.ABS dst, a
Absolute value.
AP.ABS aa, aAP.ADD dst, a, b
Adds AP operands and stores the result.
AP.ADD c, a, bAP.CBRT dst, a [, digits]
Computes the cube root.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.CBRT r3, "3", 100AP.CEIL dst, a
Ceiling of an AP value.
AP.CEIL c, xAP.CLEAR
Deletes all AP variables from the current runtime.
AP.CLEARAP.COPY dst, src
Copies an AP variable or numeric literal into another AP variable.
AP.COPY backup, resultAP.COS dst, a [, digits]
Computes cosine.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.COS c, pi, 120AP.DELETE name
Deletes one AP variable.
AP.DELETE tmpAP.DIV dst, a, b [, digits]
Divides a by b using the given digit precision, or the current AP.PRECISION setting.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.DIV q, one, seven, 120AP.E dst
Stores Euler's number into an AP variable.
AP.E eAP.EVAL dst, "expression"
Evaluates a compact arbitrary-precision expression inside the AP world. Supports AP variables, numeric literals, pi/e, + - * / ^, parentheses and functions such as sqrt, sin, cos, log, exp, pow, fact, gcd, mod. AP.LET is the friendly alias.
AP.EVAL y, "sin(pi/7)^2 + cos(pi/7)^2"
PRINT AP.STR("y", 100)AP.EXP dst, a [, digits]
Computes e^a.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.EXP ex, x, 100AP.FACT dst, a
Computes factorial for integer AP values. AP.FACTORIAL is the long alias.
AP.FACT f100, "100"AP.FACTORIAL dst, a
Long alias of AP.FACT.
AP.FACTORIAL f100, "100"AP.FLOOR dst, a
Floor of an AP value.
AP.FLOOR f, xAP.GCD dst, a, b
Greatest common divisor for integer AP values.
AP.GCD g, a, bAP.IDIV dst, a, b
Integer division quotient.
AP.IDIV q, a, bAP.IPOW dst, a, integerExponent [, digits]
Computes an integer exponent power. Useful for exact or near-exact high-precision power series tests.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.IPOW p, x, 12AP.LCM dst, a, b
Least common multiple for integer AP values.
AP.LCM l, a, bAP.LET dst, "expression"
Alias of AP.EVAL, useful when the AP expression reads like an assignment into the AP variable table.
AP.LET r, "(sqrt(2)+sqrt(3))^2"AP.LOG dst, a [, digits]
Computes the natural logarithm.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.LOG lx, x, 100AP.LOG10 dst, a [, digits]
Computes the base-10 logarithm.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.LOG10 l10, x, 100AP.MOD dst, a, b
Integer remainder.
AP.MOD r, a, bAP.MUL dst, a, b
Multiplies AP operands and stores the result.
AP.MUL p, a, bAP.NEG dst, a
Changes sign of an AP value.
AP.NEG n, aAP.PI dst
Stores pi into an AP variable.
AP.PI piAP.POW dst, a, b [, digits]
Computes a raised to b with arbitrary precision.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.POW y, x, "0.5", 100AP.PRECISION digits
Sets the global decimal digit precision used by AP arithmetic. AP variables live in a separate namespace and are not normal Basic numeric variables.
AP.PRECISION 120AP.PROD dst, index, start, end, "expression" [, step]
Evaluates an AP expression repeatedly while index is an AP integer variable, accumulating the product.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
step | Optional parameter. If omitted, the command uses its internal default. |
AP.PROD p, k, 1, 20, "1 + 1 / k^2"
PRINT AP.STR("p", 80)AP.RANDOM dst
Stores a MAPM random value in [0,1).
AP.RANDOM rndAP.ROUND dst, a, digits
Rounds an AP value.
AP.ROUND r, pi, 40AP.SET name, value
Creates or replaces an arbitrary-precision variable. Prefer quoted numeric strings for exact decimal input; numeric Basic values already have double precision.
AP.SET a, "0.1"
AP.SET b, "0.2"AP.SIN dst, a [, digits]
Computes sine.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.SIN s, pi, 120AP.SQRT dst, a [, digits]
Computes the square root.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.SQRT r2, "2", 120AP.SUB dst, a, b
Subtracts b from a and stores the result.
AP.SUB d, a, bAP.SUM dst, index, start, end, "expression" [, step]
Evaluates an AP expression repeatedly while index is an AP integer variable, accumulating the sum. The previous index variable is restored after the loop.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
step | Optional parameter. If omitted, the command uses its internal default. |
AP.PRECISION 120
AP.SUM eApprox, k, 0, 80, "1 / fact(k)"
PRINT AP.STR("eApprox", 100)AP.TAN dst, a [, digits]
Computes tangent.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
AP.TAN t, angle, 100AP.COMPARE(a, b)
Compares two AP variables or literals. Returns -1, 0 or +1.
cmp = AP.COMPARE("a", "b")AP.COUNT()
Returns how many AP variables are currently stored.
PRINT AP.COUNT()AP.DIGITS(name)
Returns the number of significant digits currently stored in the AP value.
PRINT AP.DIGITS("x")AP.DOUBLE(name)
Converts an AP value to a normal Basic double. This is an explicit lossy bridge back to ordinary expressions.
x = AP.DOUBLE("result")AP.EXISTS(name)
Returns TRUE if an AP variable exists.
IF AP.EXISTS("c") THEN PRINT AP.STR("c")AP.EXPONENT(name)
Returns the MAPM decimal exponent of the AP value.
PRINT AP.EXPONENT("x")AP.FIXED(name [, decimals])
Returns an AP value as fixed-point decimal text.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
decimals | Optional parameter. If omitted, the command uses its internal default. |
PRINT AP.FIXED("pi", 80)AP.INTSTR(name)
Returns the integer part as a string.
PRINT AP.INTSTR("f100")AP.PRECISION_VALUE()
Returns the current AP precision setting.
PRINT AP.PRECISION_VALUE()AP.SIGN(name)
Returns -1, 0 or +1 depending on the AP value sign.
PRINT AP.SIGN("x")AP.STR(name [, digits])
Returns an AP value as a string. In expressions, pass the AP variable name as a string, for example AP.STR("c", 80).
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
digits | Optional parameter. If omitted, the command uses its internal default. |
PRINT AP.STR("c", 80)AP.VERSION()
Returns the underlying MAPM library version.
PRINT AP.VERSION()