AP namespace

Arbitrary precision numeric operations.

Symbols in this namespace: 49

SymbolKindCategoryDescription
AP.ABSCommandArbitrary precision statementsAbsolute value.
AP.ADDCommandArbitrary precision statementsAdds AP operands and stores the result.
AP.CBRTCommandArbitrary precision statementsComputes the cube root.
AP.CEILCommandArbitrary precision statementsCeiling of an AP value.
AP.CLEARCommandArbitrary precision statementsDeletes all AP variables from the current runtime.
AP.COMPAREFunctionArbitrary precision functionsCompares two AP variables or literals. Returns -1, 0 or +1.
AP.COPYCommandArbitrary precision statementsCopies an AP variable or numeric literal into another AP variable.
AP.COSCommandArbitrary precision statementsComputes cosine.
AP.COUNTFunctionArbitrary precision functionsReturns how many AP variables are currently stored.
AP.DELETECommandArbitrary precision statementsDeletes one AP variable.
AP.DIGITSFunctionArbitrary precision functionsReturns the number of significant digits currently stored in the AP value.
AP.DIVCommandArbitrary precision statementsDivides a by b using the given digit precision, or the current AP.PRECISION setting.
AP.DOUBLEFunctionArbitrary precision functionsConverts an AP value to a normal Basic double. This is an explicit lossy bridge back to ordinary expressions.
AP.ECommandArbitrary precision statementsStores Euler's number into an AP variable.
AP.EVALCommandArbitrary precision statementsEvaluates 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.EXISTSFunctionArbitrary precision functionsReturns TRUE if an AP variable exists.
AP.EXPCommandArbitrary precision statementsComputes e^a.
AP.EXPONENTFunctionArbitrary precision functionsReturns the MAPM decimal exponent of the AP value.
AP.FACTCommandArbitrary precision statementsComputes factorial for integer AP values. AP.FACTORIAL is the long alias.
AP.FACTORIALCommandArbitrary precision statementsLong alias of AP.FACT.
AP.FIXEDFunctionArbitrary precision functionsReturns an AP value as fixed-point decimal text.
AP.FLOORCommandArbitrary precision statementsFloor of an AP value.
AP.GCDCommandArbitrary precision statementsGreatest common divisor for integer AP values.
AP.IDIVCommandArbitrary precision statementsInteger division quotient.
AP.INTSTRFunctionArbitrary precision functionsReturns the integer part as a string.
AP.IPOWCommandArbitrary precision statementsComputes an integer exponent power. Useful for exact or near-exact high-precision power series tests.
AP.LCMCommandArbitrary precision statementsLeast common multiple for integer AP values.
AP.LETCommandArbitrary precision statementsAlias of AP.EVAL, useful when the AP expression reads like an assignment into the AP variable table.
AP.LOGCommandArbitrary precision statementsComputes the natural logarithm.
AP.LOG10CommandArbitrary precision statementsComputes the base-10 logarithm.
AP.MODCommandArbitrary precision statementsInteger remainder.
AP.MULCommandArbitrary precision statementsMultiplies AP operands and stores the result.
AP.NEGCommandArbitrary precision statementsChanges sign of an AP value.
AP.PICommandArbitrary precision statementsStores pi into an AP variable.
AP.POWCommandArbitrary precision statementsComputes a raised to b with arbitrary precision.
AP.PRECISIONCommandArbitrary precision statementsSets 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_VALUEFunctionArbitrary precision functionsReturns the current AP precision setting.
AP.PRODCommandArbitrary precision statementsEvaluates an AP expression repeatedly while index is an AP integer variable, accumulating the product.
AP.RANDOMCommandArbitrary precision statementsStores a MAPM random value in [0,1).
AP.ROUNDCommandArbitrary precision statementsRounds an AP value.
AP.SETCommandArbitrary precision statementsCreates or replaces an arbitrary-precision variable. Prefer quoted numeric strings for exact decimal input; numeric Basic values already have double precision.
AP.SIGNFunctionArbitrary precision functionsReturns -1, 0 or +1 depending on the AP value sign.
AP.SINCommandArbitrary precision statementsComputes sine.
AP.SQRTCommandArbitrary precision statementsComputes the square root.
AP.STRFunctionArbitrary precision functionsReturns an AP value as a string. In expressions, pass the AP variable name as a string, for example AP.STR("c", 80).
AP.SUBCommandArbitrary precision statementsSubtracts b from a and stores the result.
AP.SUMCommandArbitrary precision statementsEvaluates an AP expression repeatedly while index is an AP integer variable, accumulating the sum. The previous index variable is restored after the loop.
AP.TANCommandArbitrary precision statementsComputes tangent.
AP.VERSIONFunctionArbitrary precision functionsReturns the underlying MAPM library version.

AP.ABS

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.ABS dst, a

Absolute value.

Minimal example

AP.ABS aa, a

AP.ADD

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.ADD dst, a, b

Adds AP operands and stores the result.

Minimal example

AP.ADD c, a, b

AP.CBRT

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.CBRT dst, a [, digits]

Computes the cube root.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.CBRT r3, "3", 100

AP.CEIL

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.CEIL dst, a

Ceiling of an AP value.

Minimal example

AP.CEIL c, x

AP.CLEAR

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.CLEAR

Deletes all AP variables from the current runtime.

Minimal example

AP.CLEAR

AP.COMPARE

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.COMPARE(a, b)

Compares two AP variables or literals. Returns -1, 0 or +1.

Minimal example

cmp = AP.COMPARE("a", "b")

AP.COPY

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.COPY dst, src

Copies an AP variable or numeric literal into another AP variable.

Minimal example

AP.COPY backup, result

AP.COS

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.COS dst, a [, digits]

Computes cosine.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.COS c, pi, 120

AP.COUNT

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.COUNT()

Returns how many AP variables are currently stored.

Minimal example

PRINT AP.COUNT()

AP.DELETE

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.DELETE name

Deletes one AP variable.

Minimal example

AP.DELETE tmp

AP.DIGITS

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.DIGITS(name)

Returns the number of significant digits currently stored in the AP value.

Minimal example

PRINT AP.DIGITS("x")

AP.DIV

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.DIV dst, a, b [, digits]

Divides a by b using the given digit precision, or the current AP.PRECISION setting.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.DIV q, one, seven, 120

AP.DOUBLE

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.DOUBLE(name)

Converts an AP value to a normal Basic double. This is an explicit lossy bridge back to ordinary expressions.

Minimal example

x = AP.DOUBLE("result")

AP.E

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.E dst

Stores Euler's number into an AP variable.

Minimal example

AP.E e

AP.EVAL

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.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.

Minimal example

AP.EVAL y, "sin(pi/7)^2 + cos(pi/7)^2"
PRINT AP.STR("y", 100)

AP.EXISTS

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.EXISTS(name)

Returns TRUE if an AP variable exists.

Minimal example

IF AP.EXISTS("c") THEN PRINT AP.STR("c")

AP.EXP

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.EXP dst, a [, digits]

Computes e^a.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.EXP ex, x, 100

AP.EXPONENT

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.EXPONENT(name)

Returns the MAPM decimal exponent of the AP value.

Minimal example

PRINT AP.EXPONENT("x")

AP.FACT

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.FACT dst, a

Computes factorial for integer AP values. AP.FACTORIAL is the long alias.

Minimal example

AP.FACT f100, "100"

AP.FACTORIAL

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.FACTORIAL dst, a

Long alias of AP.FACT.

Minimal example

AP.FACTORIAL f100, "100"

AP.FIXED

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.FIXED(name [, decimals])

Returns an AP value as fixed-point decimal text.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
decimalsOptional parameter. If omitted, the command uses its internal default.

Minimal example

PRINT AP.FIXED("pi", 80)

AP.FLOOR

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.FLOOR dst, a

Floor of an AP value.

Minimal example

AP.FLOOR f, x

AP.GCD

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.GCD dst, a, b

Greatest common divisor for integer AP values.

Minimal example

AP.GCD g, a, b

AP.IDIV

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.IDIV dst, a, b

Integer division quotient.

Minimal example

AP.IDIV q, a, b

AP.INTSTR

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.INTSTR(name)

Returns the integer part as a string.

Minimal example

PRINT AP.INTSTR("f100")

AP.IPOW

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.IPOW dst, a, integerExponent [, digits]

Computes an integer exponent power. Useful for exact or near-exact high-precision power series tests.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.IPOW p, x, 12

AP.LCM

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.LCM dst, a, b

Least common multiple for integer AP values.

Minimal example

AP.LCM l, a, b

AP.LET

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.LET dst, "expression"

Alias of AP.EVAL, useful when the AP expression reads like an assignment into the AP variable table.

Minimal example

AP.LET r, "(sqrt(2)+sqrt(3))^2"

AP.LOG

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.LOG dst, a [, digits]

Computes the natural logarithm.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.LOG lx, x, 100

AP.LOG10

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.LOG10 dst, a [, digits]

Computes the base-10 logarithm.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.LOG10 l10, x, 100

AP.MOD

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.MOD dst, a, b

Integer remainder.

Minimal example

AP.MOD r, a, b

AP.MUL

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.MUL dst, a, b

Multiplies AP operands and stores the result.

Minimal example

AP.MUL p, a, b

AP.NEG

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.NEG dst, a

Changes sign of an AP value.

Minimal example

AP.NEG n, a

AP.PI

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.PI dst

Stores pi into an AP variable.

Minimal example

AP.PI pi

AP.POW

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.POW dst, a, b [, digits]

Computes a raised to b with arbitrary precision.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.POW y, x, "0.5", 100

AP.PRECISION

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.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.

Minimal example

AP.PRECISION 120

AP.PRECISION_VALUE

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.PRECISION_VALUE()

Returns the current AP precision setting.

Minimal example

PRINT AP.PRECISION_VALUE()

AP.PROD

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.PROD dst, index, start, end, "expression" [, step]

Evaluates an AP expression repeatedly while index is an AP integer variable, accumulating the product.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
stepOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.PROD p, k, 1, 20, "1 + 1 / k^2"
PRINT AP.STR("p", 80)

AP.RANDOM

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.RANDOM dst

Stores a MAPM random value in [0,1).

Minimal example

AP.RANDOM rnd

AP.ROUND

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.ROUND dst, a, digits

Rounds an AP value.

Minimal example

AP.ROUND r, pi, 40

AP.SET

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.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.

Minimal example

AP.SET a, "0.1"
AP.SET b, "0.2"

AP.SIGN

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.SIGN(name)

Returns -1, 0 or +1 depending on the AP value sign.

Minimal example

PRINT AP.SIGN("x")

AP.SIN

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.SIN dst, a [, digits]

Computes sine.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.SIN s, pi, 120

AP.SQRT

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.SQRT dst, a [, digits]

Computes the square root.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.SQRT r2, "2", 120

AP.STR

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

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).

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

PRINT AP.STR("c", 80)

AP.SUB

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.SUB dst, a, b

Subtracts b from a and stores the result.

Minimal example

AP.SUB d, a, b

AP.SUM

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.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.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
stepOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.PRECISION 120
AP.SUM eApprox, k, 0, 80, "1 / fact(k)"
PRINT AP.STR("eApprox", 100)

AP.TAN

STATEMENTAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Command   Category: Arbitrary precision statements   Namespace: AP

AP.TAN dst, a [, digits]

Computes tangent.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
digitsOptional parameter. If omitted, the command uses its internal default.

Minimal example

AP.TAN t, angle, 100

AP.VERSION

FUNCTIONAPBATCH-FRIENDLYARBITRARY PRECISION
Kind: Function   Category: Arbitrary precision functions   Namespace: AP

AP.VERSION()

Returns the underlying MAPM library version.

Minimal example

PRINT AP.VERSION()