7 Scientific Functions
The scientific keys extend ordinary arithmetic to powers, logarithms, angles, counting problems, and special functions. Most need one operand; a few need two, whose order matters. The same mathematical keys are available in RPN and ALG, but the entry sequence follows the working rules of the selected mode.
This chapter concentrates on real-number calculations. Its domains and examples assume that COMPLEX is off. Complex mode changes the meaning and domain of several functions, including powers, roots, and factorial; chapter 8 explains those extensions and their limits. Working precision and display rounding remain the separate choices explained in chapter 5.
A reproducible starting point
One operand, two operands, or a new value
7.2 Arithmetic, reciprocal, powers, and roots
7.3 Exponential and logarithmic functions
7.4 Angle units and trigonometric functions
A direction from two coordinates
7.5 Hyperbolic functions and their inverses
7.6 Absolute value, integer parts, and rounding
7.7 Two different remainder conventions
7.8 Percentages and their retained base
7.9 Factorials, permutations, and combinations
7.10 Gamma and logarithmic factorials
7.11 The error function and its complement
7.12 Constants and random numbers
7.13 Domains, errors, and useful checks
7.1 Finding and applying a scientific function
Show the Scientific panel by swiping right across the top two keyboard rows in portrait. In landscape, the scientific keys are already in the left bank. Table 7.1 maps every main and shifted function in those two rows. Press f for the orange column or g for the blue column, followed by the key in the first column. For example, f LN means orange shift followed by the \(e^x\) key carrying the LN legend.
Main key |
Orange function |
Blue function |
SIN |
DEG |
\(\mathrm {SIN}^{-1}\) |
COS |
RAD |
\(\mathrm {COS}^{-1}\) |
TAN |
GRAD |
\(\mathrm {TAN}^{-1}\) |
HYP |
\(\mathrm {HYP}^{-1}\) |
atan2 |
\(\Gamma \) |
\(\ln \Gamma \) |
\(nPr\) |
\(\sqrt {x}\) |
\(x^2\) |
erf |
\(e^x\) |
LN |
erfc |
\(10^x\) |
LOG |
\(\mathrm {LOG}_2\) |
\(y^x\) |
\(\sqrt [x]{y}\) |
\(\log _y x\) |
\(x!\) |
\(\ln x!\) |
\(nCr\) |
Other scientific operations use alternate legends on the fixed keys. Their physical locations are collected in table 7.2. Settings such as FIX, FSE, and PREC are covered in chapter 5; complex controls and CONV are covered in chapter 8 and chapter 9.
| Physical key | Scientific alternate functions |
| ENTER (RPN) | Orange INT; blue FRAC. |
| \(1/x\) (ALG) | Orange INT; blue FRAC. |
| 9 | Orange DRG, to cycle angle units; blue NINT. |
| 4 | Blue RAN#. |
| 5 | Blue ceiling, \(\lceil x\rceil \). |
| 6 | Blue floor, \(\lfloor x\rfloor \). |
| \(\times \) | Orange ABS; blue REM. |
| \(\div \) | Blue MOD. |
| 1, 2, 3 | Blue %, \(\Delta \%\), and T%, respectively. |
| 0 | Orange \(\pi \). |
| . | Orange \(e\), Euler’s number. |
| \(\leftarrow \) | Orange \(\ln 2\). |
A reproducible starting point
Unless an example specifies otherwise, use real mode, 600 working digits, and FIX 4. RPN examples use a fixed stack of 5. Set these through the procedures in section 2.2, section 5.2 and section 5.4. Set any required angle unit before entering functions. Check that there is no active shift, pending command, or open tool before starting a sequence.
In RPN, f CLEAR is the orange function of \(1/x\); in ALG, CLEAR is an unshifted editing key. The worked examples below include the appropriate clear. These clears leave memory banks intact, and no example depends on their earlier contents.
One operand, two operands, or a new value
In RPN, a unary function finishes any active entry and replaces X, the current value displayed at S0. A binary function uses Y (displayed at S1) first and X second, normally dropping the stack afterward. The three percentage functions instead keep Y and every deeper position. Constants and RAN# need no operand: they lift a new value into X. Last X and Last Y are saved operands from earlier operations, not the current S0 and S1 values. See section 2.5 and section 2.9 for their capture and recall rules.
In ALG, a unary function can precede its argument or follow the operand to which it applies. For example, SIN 30 ) = and 30 SIN = are two ways to calculate the sine of 30 in the selected angle unit. A binary key normally goes between its two operands. Alternatively, FUNC followed by the function opens a call with two arguments; separate them with g FUNC and finish with ). The first argument corresponds to RPN’s Y, the second to X; ALG has no current S0/S1 stack positions. Mathematical symbols such as \(x\) and \(y\) describe the arguments of a formula, not extra registers. Chapter 4 explains grouping and precedence.
7.2 Arithmetic, reciprocal, powers, and roots
Addition, subtraction, multiplication, and division use their ordinary keys. In RPN their order is \(Y+X\), \(Y-X\), \(YX\), and \(Y/X\). The \(1/x\) key replaces a number with its reciprocal. Division and reciprocal require a nonzero divisor for a finite answer. The sign-change key +/\(-\) negates an operand; while a number is being entered, it edits the sign of the coefficient or the active exponent instead.
Square root is the main \(\sqrt {x}\) key, and square is its orange function. A real square root requires \(X\geq 0\); the result is the nonnegative root. The square of a negative number is positive, so squaring followed by square root returns its absolute value, not its original sign.
For \(y^x\), put the base in Y and exponent in X, or enter base, power key, exponent in ALG. A positive base accepts any finite real exponent, subject to numerical range. A negative base requires an integer exponent for a real result from this key. A fractional exponent such as a calculated \(1/3\) does not request the real cube root of a negative number. Use the indexed root key for that purpose.
The orange \(\sqrt [x]{y}\) function takes the radicand first and the root index second. For an integer index, real mode accepts nonzero integers from \(-1\,000\,000\) through \(1\,000\,000\). An odd index permits a negative radicand; an even index requires a nonnegative one. A negative index returns the reciprocal of the corresponding positive-index root, so the radicand must be nonzero for a finite result. Index zero is rejected.
A noninteger index is also accepted for a nonnegative radicand and is evaluated as \(Y^{1/X}\). It cannot obtain a real root of a negative radicand. Zero raised to a negative power, or used with a negative root index, has no finite result. These restrictions describe real mode; complex principal roots can differ even when a real root exists.
Choose the real cube root and a reciprocal root
Use the chapter’s RPN starting state. Enter:
f CLEAR 125 +/\(-\) ENTER 3 f \(\sqrt [x]{y}\)
The result is -5.0000, since \((-5)^3=-125\). For an independent calculation, enter:
f CLEAR 16 ENTER 2 +/\(-\) f \(\sqrt [x]{y}\)
The index is \(-2\); the result is \(1/\sqrt {16}=0.25\), displayed as 0.2500.
Combine a square and square root in ALG
Use the chapter’s ALG starting state. Calculate \(\sqrt {3^2+4^2}\):
CLEAR ( 3 f \(x^2\) + 4 f \(x^2\) ) \(\sqrt {x}\) =
The display is 5.0000. The closing parenthesis makes the entire sum, 25, the operand of square root. Without that group, a postfix square root would apply only to the preceding operand.
7.3 Exponential and logarithmic functions
\(e^x\) raises Euler’s number to the operand, and \(10^x\) raises 10 to it. They accept positive, zero, and negative real exponents. They are functions of an existing number; EEX, by contrast, introduces a power-of-ten exponent while typing a number. For example, entering 2 EEX 3 means 2000, whereas applying \(10^x\) to 3 produces 1000.
The three single-operand logarithms differ only in base: f LN gives \(\ln X\), f LOG gives \(\log _{10}X\), and g \(\mathrm {LOG}_2\) gives \(\log _2X\). Their finite real domain is \(X>0\). LN and \(e^x\) are inverse functions, as are LOG and \(10^x\), within the precision and range of the calculation.
The blue function of \(y^x\) calculates a logarithm to an arbitrary base:
Enter the base first, then the argument. The base must be positive and different from 1; the argument must be positive. A base between zero and one is valid and reverses the usual sign pattern: \(\log _{1/2}8=-3\), because \((1/2)^{-3}=8\). A base extremely close to 1 makes this quotient sensitive to small errors in the base.
Find a power of two and use a fractional base
Use the chapter’s RPN starting state. For the binary logarithm:
f CLEAR 32 g \(\mathrm {LOG}_2\)
The display is 5.0000. For the arbitrary-base calculation, start again:
f CLEAR .5 ENTER 8 g \(\log _y x\)
The display is -3.0000. The first operand, 0.5, is the base; it is not the number whose logarithm is requested.
Enter a logarithm call in ALG
Use the chapter’s ALG starting state. Press:
CLEAR FUNC g \(\log _y x\) 3 g FUNC 81 ) =
The blue FUNC supplies the argument comma. The expression represents \(\log _3 81\) and displays 4.0000. The logarithm key is the blue function of \(y^x\).
7.4 Angle units and trigonometric functions
The angle setting tells SIN, COS, and TAN how to interpret their operand, and tells the inverse functions which unit to return. Select a unit directly with the orange functions of SIN, COS, and TAN, or cycle it with f 9, the DRG function. The cycle is DEG, RAD, GRAD, then DEG again.
| Flag | Select with |
Full turn | Right angle |
| DEG | f SIN |
\(360\) | \(90\) |
| RAD | f COS |
\(2\pi \) | \(\pi /2\) |
| GRAD | f TAN |
\(400\) | \(100\) |
Changing the angle setting does not convert a number already entered or stored. If X contains 30, selecting RAD leaves it as 30 and a following SIN calculates \(\sin (30\text { radians})\). Use the angle family in CONV when you want to convert the numerical value itself; see chapter 9.
The setting is shared between modes and can be changed without finishing a numeric entry. In ALG, each trigonometric function retains the unit selected when its function key was pressed. Changing the flag afterward does not change functions already in the expression. Choose the desired unit before inserting the function, and check its unit-bearing expression label if the setting has since changed.
SIN and COS have finite real values for all finite real angles. TAN has poles at odd multiples of a right angle, such as \(90^\circ \) and \(270^\circ \). An angle close to a pole can produce a very large finite value. More displayed digits do not make an uncertain angle near a pole reliable.
Calculate the same sine in degrees and radians
Use the chapter’s RPN starting state. Select degrees in the sequence:
f CLEAR f DEG 30 SIN
The display is 0.5000. Now clear and use radians:
f CLEAR f RAD f \(\pi \) 6 \(\div \) SIN
The orange \(\pi \) function is on 0. The sequence calculates \(\sin (\pi /6)\), again displaying 0.5000. The constant lifts directly onto the stack; no ENTER is needed before the following new operand 6.
The blue SIN, COS, and TAN functions are inverse sine, inverse cosine, and inverse tangent. Their superscript \(-1\) means inverse function, not reciprocal. To obtain \(1/\sin x\), apply SIN and then \(1/x\) instead.
| Function | Input |
Result range |
| g SIN | \(-1\leq X\leq 1\) |
\([-90^\circ ,90^\circ ]\) |
| g COS | \(-1\leq X\leq 1\) |
\([0^\circ ,180^\circ ]\) |
| g TAN | Any finite real \(X\) |
\((-90^\circ ,90^\circ )\) |
An inverse function returns one principal angle rather than every angle with the same sine, cosine, or tangent. For example, both \(30^\circ \) and \(150^\circ \) have sine 0.5, but inverse sine returns \(30^\circ \).
A direction from two coordinates
atan2, the blue function of HYP, uses both coordinates to preserve the quadrant. Its order is \(\operatorname {atan2}(y,x)\): enter the vertical coordinate first and the horizontal coordinate second. In RPN those occupy Y and X. The result is an angle from the positive horizontal axis, in the selected unit, between \(-180^\circ \) and \(180^\circ \) or the equivalent in radians or gradians. A positive vertical coordinate chooses the upper half-plane; a negative one chooses the lower. Unlike computing \(\tan ^{-1}(y/x)\), atan2 retains the signs of both coordinates and accepts a zero horizontal coordinate. The origin has no geometrical direction; do not interpret the numerical convention returned for two zeros as a measured angle.
Keep the quadrant of a direction
Use the chapter’s RPN starting state. For the point \((x,y)=(-1,1)\), press:
f CLEAR f DEG 1 ENTER 1 +/\(-\) g atan2
The result is 135.0000 degrees. Dividing the coordinates first would give \(-1\), whose ordinary inverse tangent is \(-45^\circ \); that ratio alone cannot identify the quadrant.
7.5 Hyperbolic functions and their inverses
HYP is a selection prefix. Press it, then unshifted SIN, COS, or TAN to choose hyperbolic sine, cosine, or tangent. For an inverse, press f HYP, then unshifted SIN, COS, or TAN. The HYP or INVHYP indicator remains until the selection is completed. The prefix is used once; the next ordinary SIN is trigonometric again.
Do not insert another shift between HYP and the trigonometric key: that shift cancels the hyperbolic selection. An unshifted backspace also cancels the pending selection without editing the operand. In ALG, use the HYP sequence directly, without putting FUNC before it. The selected unary function opens a call if an argument is needed or acts on the preceding operand.
Hyperbolic functions use numerical arguments, not angles. DEG, RAD, and GRAD have no effect on them. Their definitions include
All three accept finite real inputs, subject to numerical range. Inverse hyperbolic sine accepts every finite real input; inverse hyperbolic cosine requires \(X\geq 1\) and returns a nonnegative value; inverse hyperbolic tangent requires \(-1<X<1\) for a finite real result. Its endpoints are singular.
Apply and reverse a hyperbolic cosine in ALG
Use the chapter’s ALG starting state. The angle setting may be any unit. Press:
CLEAR HYP COS 1 ) =
The result, \(\cosh 1\), displays as 1.5431. Continue with:
f HYP COS =
The inverse hyperbolic cosine returns 1.0000. It uses the retained value of \(\cosh 1\), not the four-place readout 1.5431. The final equals press completes the new ALG answer.
7.6 Absolute value, integer parts, and rounding
ABS, the orange function of multiplication, returns the nonnegative magnitude of a real number. The integer functions have different rules for choosing an integer; their differences matter especially for negative inputs. They change the operand itself, independently of FIX, SCI, or ENG.
| Function and location | Rule |
| INT: orange ENTER (RPN), orange \(1/x\) (ALG) | Truncate toward zero, discarding the fractional part. |
| FRAC: blue ENTER (RPN), blue \(1/x\) (ALG) | Return \(X-\operatorname {trunc}(X)\); a nonzero fraction has the input’s sign. |
| NINT: blue 9 | Nearest integer; an exact tie goes to the even integer. |
| \(\lceil x\rceil \): blue 5 | Ceiling: the least integer greater than or equal to \(X\). |
| \(\lfloor x\rfloor \): blue 6 | Floor: the greatest integer less than or equal to \(X\). |
For \(-2.75\), INT gives \(-2\), FRAC gives \(-0.75\), NINT and floor give \(-3\), and ceiling gives \(-2\). Thus INT is not the same as floor, and FRAC is not always positive. NINT’s tie rule sends 2.5 to 2, 3.5 to 4, \(-2.5\) to \(-2\), and \(-3.5\) to \(-4\). These exact halves are representable in binary; a computed value merely displayed as a half may lie on one side of the tie internally.
Separate a signed number into two parts
Use the chapter’s RPN starting state. Try these independently:
Complete sequence |
Display |
f CLEAR 2.75 +/\(-\) f ENTER |
-2.0000 |
f CLEAR 2.75 +/\(-\) g ENTER |
-0.7500 |
The first row selects INT and the second selects FRAC. The two mathematical parts sum to the original \(-2.75\). In ALG, use f \(1/x\) for integer part, or g \(1/x\) for FRAC; then press the separate = to finish the expression.
Financial RND is a separate function in both modes on the blue PMT legend. It rounds to the selected number of decimal places, with ties away from zero. It is neither NINT nor a display-only change; in ALG it requires a completed expression or a single entered number and updates ANS. See section 5.6.
7.7 Two different remainder conventions
Both remainder keys divide the first operand by the second and return what is left after subtracting an integer multiple of the divisor. Their difference is the rule for that integer. With dividend \(Y\) and nonzero divisor \(X\),
MOD, the blue division function, chooses \(q=\operatorname {trunc}(Y/X)\), toward zero. Its nonzero result has the dividend’s sign and magnitude less than the divisor’s magnitude. This is a truncating remainder; despite the MOD legend, it is not a rule that always returns a nonnegative residue.
REM, the blue multiplication function, chooses the nearest integer to \(Y/X\), with exact quotient ties going to the even integer. This is the IEEE remainder convention. Its magnitude is at most half the divisor’s magnitude, and its sign can differ from the dividend’s sign. The quotient selection uses the mathematical quotient for the remainder operation, not a displayed rounded quotient.
| Dividend | MOD quotient | MOD result | REM quotient | REM result |
| 7 | 1 | 3 | 2 | \(-1\) |
| \(-7\) | \(-1\) | \(-3\) | \(-2\) | 1 |
| 6 | 1 | 2 | 2 | \(-2\) |
| 10 | 2 | 2 | 2 | 2 |
The last two rows illustrate REM ties: 1.5 and 2.5 both choose the even quotient 2. Both functions also accept noninteger operands; these are real-number remainder operations, not integer-only keys. A zero divisor has no finite remainder.
Compare MOD and REM in both modes
Use the chapter’s RPN starting state and try:
f CLEAR 7 ENTER 4 g \(\div \)
MOD gives 3.0000. Repeat from CLEAR, replacing the last shifted division key with g \(\times \); REM gives -1.0000.
Then select ALG, retaining the chapter’s real-mode and precision settings, and use the binary key between the operands:
CLEAR 7 g \(\div \) 4 =
This gives 3.0000. Repeat from CLEAR with g \(\times \) instead to obtain -1.0000.
Use MOD and REM for remainders. The keyboard’s blue 1 computes a percentage, a different operation described next.
7.8 Percentages and their retained base
The three percentage operations are available on blue 1, 2, and 3. They each need two operands. Rates and percentage results are expressed in percent units: enter 12.5 for 12.5 percent, not 0.125.
| Key | Operands in order |
Result |
| g 1: % | Base \(Y\), rate \(X\) |
\(YX/100\) |
| g 2: \(\Delta \%\) | Original \(Y\), new amount \(X\) |
\(100(X-Y)/Y\) |
| g 3: T% | Total \(Y\), part \(X\) |
\(100X/Y\) |
Percentage change and percentage of a total require a nonzero first operand. Negative bases and amounts follow the displayed formulas; interpret their signs in the context of the problem. Percentage change is relative to the original value, so reversing the operands generally changes both the sign and the magnitude of the answer.
In RPN, all three replace X and retain Y and every deeper register. They save both original operands in the Last registers. The retained base makes adding or subtracting a percentage amount convenient, but leaves an extra stack operand when you only wanted the percentage result. In ALG, each is simply a binary expression operation; there is no retained RPN base.
Increase an amount by 12.5 percent
Use the chapter’s RPN starting state. Press:
f CLEAR 240 ENTER 12.5 g 1
The percentage amount is 30.0000 in S0 (X), with 240 retained in S1 (Y). Press + to obtain 270.0000.
For the same calculation in ALG, keep the real, precision, and display settings, with no pending prefix. Enter the base explicitly:
CLEAR 240 + ( 240 g 1 12.5 ) =
The result is again 270.0000. The group calculates the percentage amount; the first 240 supplies the amount to increase.
For percentage-change and share examples, including their RPN stack effects, see section 3.7. ALG’s FUNC form uses the same operand order as table 7.7.
7.9 Factorials, permutations, and combinations
For a nonnegative integer \(n\), factorial is \(n!=1\times 2\times \cdots \times n\), with \(0!=1\). Use the main \(x!\) key. In real mode, the input must be an integer from 0 through 10 000. A noninteger input is rejected; use Gamma when a continuous extension is the intended calculation.
Permutations count ordered selections without replacement; combinations count selections when order does not matter:
The blue Gamma function is \(nPr\), and the blue factorial function is \(nCr\). Enter the number of available objects \(n\) first and the number selected \(r\) second. Both must be integers satisfying \(0\leq r\leq n\leq 10\,000\). Choosing no objects gives 1 for either operation. These are ordinary binary functions in RPN and drop the stack.
Factorials and counting results can contain many digits. The argument limit is a work bound, not a guarantee that every resulting integer fits exactly at your chosen precision. A large count may be rounded internally even though the mathematical answer is an integer. Raising working precision before calculating can preserve more of its digits.
Select three people from ten
Use the chapter’s RPN starting state. For three distinct roles, order matters:
f CLEAR 10 ENTER 3 g \(nPr\)
The result is 720.0000, since there are \(10\times 9\times 8\) ways to fill the roles. For a group of three with no distinct roles, repeat from CLEAR using \(nCr\):
f CLEAR 10 ENTER 3 g \(nCr\)
The result is 120.0000. Each group was counted \(3!=6\) times in the ordered result, so \(720/6=120\).
In ALG, use \(n\), shifted function, \(r\), then equals, or the explicit two-argument FUNC form described in section 4.6. Neither key assumes that a repeated selection or replacement is allowed; choose a different formula for those counting problems.
7.10 Gamma and logarithmic factorials
Gamma extends the factorial relationship beyond integer inputs: \(\Gamma (n+1)=n!\) for nonnegative integers \(n\). In particular, \(\Gamma (5)=4!=24\), not \(5!\). The main Gamma key applies \(\Gamma (X)\) directly. For positive real \(x\), one definition is
Gamma also has finite real values at negative nonintegers. It has poles at zero and the negative integers, and changes sign between those poles.
Orange Gamma, \(\ln \Gamma \), computes the real natural logarithm of Gamma. It is finite where Gamma is finite and positive, including every positive real input and some intervals below zero. It is not \(\ln |\Gamma (X)|\): where Gamma is negative, there is no real logarithm. For example, \(\Gamma (-1/2)<0\), so real-mode \(\ln \Gamma (-1/2)\) has no finite real answer. At the poles, the Gamma and logarithmic-Gamma operations are likewise not finite evaluations. See chapter 8 for complex logarithmic values and branch conventions.
Orange factorial, \(\ln x!\), calculates \(\ln \Gamma (X+1)\) directly. Its real-mode input must be a finite nonnegative integer, but it does not share factorial’s 10 000-input limit. Computing the logarithm directly avoids constructing the much larger factorial first. Both \(\ln (0!)\) and \(\ln (1!)\) are zero. Logarithmic results still have finite precision and numerical range; removing the factorial work bound does not remove those limits.
Compare factorial, Gamma, and their logarithms
Use the chapter’s RPN starting state. Each row is independent and includes its clear:
Complete sequence |
Display |
f CLEAR 5 \(x!\) |
120.0000 |
f CLEAR 5 \(\Gamma \) |
24.0000 |
f CLEAR .5 \(\Gamma \) |
1.7725 |
f CLEAR 5 f \(\ln \Gamma \) |
3.1781 |
f CLEAR 5 f \(\ln x!\) |
4.7875 |
The half-integer identity is \(\Gamma (1/2)=\sqrt {\pi }\). The last two rows are \(\ln 24\) and \(\ln 120\), respectively.
7.11 The error function and its complement
The blue square-root function is erf, the error function; the blue exponential function is erfc, its complement:
Both accept every finite real input. The error function is odd: \(\operatorname {erf}(-x)=-\operatorname {erf}(x)\). At zero, erf is 0 and erfc is 1. For real inputs, erf lies between \(-1\) and 1, and erfc between 0 and 2; sufficiently extreme inputs and finite precision can produce rounded endpoint values.
Use erfc directly when you need a small complement. Subtracting an erf value very close to 1 from 1 can lose useful digits or give zero if erf has already rounded to 1. The dedicated complementary function avoids that particular subtraction. This is a numerical reason to have both keys, even though their definitions are closely related.
Find a normal-distribution upper-tail probability
For a standard normal variable, the probability above \(z\) is \(\tfrac 12\operatorname {erfc}(z/\sqrt 2)\). Use the chapter’s RPN starting state. For \(z=2\), press:
f CLEAR 2 ENTER 2 \(\sqrt {x}\) \(\div \) g erfc 2 \(\div \)
The result displays as 0.0228; its leading digits are 0.0227501319. It is a probability, approximately 2.275 percent. The first division forms \(2/\sqrt 2\); the last divides erfc by 2. The erfc key is the blue function of \(e^x\).
Complex erf and erfc use a different calculation for nonreal inputs and have additional magnitude and convergence limits. Those restrictions do not impose a magnitude-100 bound on the real inputs described here; see chapter 8.
7.12 Constants and random numbers
Three mathematical constants have direct keys. They are generated at the current working precision, so you do not need to type a short decimal approximation.
| Constant | Sequence | Leading digits |
| \(\pi \) | f 0 | 3.14159265358979323846… |
| \(e\) | f . | 2.71828182845904523536… |
| \(\ln 2\) | f \(\leftarrow \) | 0.69314718055994530942… |
Here \(e\) is Euler’s number, the base of natural logarithms; it is not the EEX exponent-entry key. In RPN a constant commits any active number, then lifts the constant into X, preserving both Last registers. In an unfinished ALG expression, a constant inserted after an operand starts an implicit product; after a completed answer, it starts a new expression. Constants do not use FUNC.
Use pi without typing its digits
Use the chapter’s ALG starting state. For the circumference \(2\pi r\) of a circle of radius 3, press:
CLEAR 2 f 0 \(\times \) 3 =
The constant supplies the implicit multiplication in \(2\pi \). The result is 18.8496, in the same length unit as the radius. The calculation uses the working-precision value of pi, not 3.1416.
RAN#, the blue function of 4, generates a new real number \(u\) satisfying \(0\leq u<1\). It uses random decimal digits at the working precision, rather than rounding a machine-size random fraction to a longer display. It takes no operand and follows the same RPN lift and ALG insertion rules as a constant. Each press requests another value; repeated values are possible, and the keyboard provides no seed-setting or repeat-sequence control.
Generate a value in the unit interval
Use the chapter’s RPN starting state. Press:
f CLEAR g 4
The result is a random value at least zero and strictly less than one. There is no prescribed decimal answer to compare. Press g 4 again: the new draw occupies X and the first moves to Y. A displayed 1.0000 can be rounding of a value below 1; the interval statement concerns the stored number, not its four-place readout.
7.13 Domains, errors, and useful checks
Check the domain before treating a result as a usable real number. A negative square-root input, a nonpositive logarithm input, or an inverse-trigonometric input outside its real interval can lead to NaN or infinity in RPN. Other functions, such as factorial, indexed root, and arbitrary-base logarithm, issue specific input errors. ALG rejects nonfinite values when evaluating an expression. A message and a nonfinite readout are different ways in which a calculation can fail to provide a finite answer; neither is an ordinary numerical result to carry into later work.
When a function rejects its operands, check whether an entry has already been committed before deciding how to edit it. In RPN, inspect X and Y; in ALG, inspect the expression and its trailing operand. Use the correction procedures in section 3.8 and section 4.9. LAST X and LAST Y recover saved operands after successful RPN arithmetic; they are not a general error-recovery or undo mechanism.
Near a tangent pole or a logarithm base of 1, small input errors can dominate an otherwise finite answer. Check the angle unit and operand order first, then use the precision checks in section 5.8.
Finally, selecting complex mode changes the calculation, not just its display. A complex principal root need not be the real odd root used here, and real-only operations still use real components. Before using complex mode to extend a domain, follow chapter 8 for its entry rules, principal values, and current numerical limitations.