Display Conversion
decimal
Shows a number as a decimal: to the places asked for (decimal(1/2, 2) is 0.50), or else to 6 places, fewer when the decimal ends sooner (decimal(7/8) is 0.875) or the number is approximate. The result is a decimal value: its digits are what is shown, and it is the exact number they name in arithmetic and comparisons (-d, d > 0). A list gives each item's digits. A third argument "even" rounds an exact half to the even digit, as NCERT does: decimal(2.745, 2, "even") is 2.74.
x (number) --
digits (number) -- optional, defaults to 6
float
Converts a number to a native IEEE double and displays it -- a genuinely approximate conversion, unlike decimal()/scientific() which stay exact to the requested precision.
x (number) -- a number or an exact expression
approx
The number as a double, usable in arithmetic, a plot or a long sum: approx(2 + sqrt(5)) is 4.236068 as a number, where float() gives the digits as text. approx of a list is a list of doubles. Pair it with fsum(term, k, a, b) for sums whose exact form would be too long.
x (number) -- a number, an exact expression or a list of them
scientific
Shows a number in scientific notation to a given number of significant figures (defaults to 6). The result is also the number those figures name, so S = scientific(55115.9, 2) is 55000 in arithmetic, and {{S}} on a page shows 5.5 x 10^4. A third argument "even" rounds an exact half to the even digit, as NCERT does: scientific(2.745, 3, "even") is 2.74.
x (number) --
sigDigits (number) -- optional, defaults to 6
sigFigs
The number of significant figures of a number as written, given as text: every non-zero digit, zeros between them, zeros after the last non-zero digit only when there is a decimal point (100.100 has 6, 1500 has 2), never leading zeros (0.0010010 has 5); a power of ten is left out (2.64e24 has 3).
number (string) -- The number as written, in quotes
repeating
Renders the exact repeating-decimal expansion of a fraction, e.g. 1/6 -> 0.1(6). An optional base (2-63) computes the expansion in that base instead of base 10.
x (number) --
base (number) -- optional, 2-63, defaults to 10
exact
The exact form of a value, the other side of decimal(). A = defint(exp(-x), x, 0, 1) is a number in arithmetic, and on a page {{A}} shows its digits, so a typed answer's key is digits; exact(A) is 1 - 1/e, so a page can show {{exact(A)}} and {{A:4dp}} side by side. A plain script shows the exact form of such a line anyway. A value worked out from it (A + 1) or a measured decimal has no exact form known, and is refused.
x (number) -- a number, a name bound to one, or an expression
table
Creates a mutable result table with one or more display-column headers. Use addRow() to append scalar, vector, or matrix values, then evaluate the table variable to render it.
headers (string...) -- one quoted header per column
addRow
Appends one complete row to a table. The number of values must match its headers; every value uses its normal APAScript display form.
table (table) -- a bound table variable
values (value...) -- one scalar, vector, or matrix value for each column
notation
Chooses how nPr and nCr are written for the rest of the run: "us" writes them as US books do, P(8, 3) and C(8, 3); "ncert" writes {}^{8}P_{3} and {}^{8}C_{3}, as NCERT does (the default). Only the writing changes; the values are the same. Each run starts with the default.
style (string) -- "us" or "ncert"