798 Appendix A: Functions and Instructions
For CATALOG
For
var
,
low
,
high
[,
step
]
block
EndFor
Executes the statements in
block
iteratively for each
value of
var
, from
low
to
high
, in increments of
step
.
var
must not be a system variable.
step
can be positive or negative. The default value is
1.
block
can be either a single statement or a series of
statements separated with the “:” character.
Program segment:
©
:0! tempsum : 1! step
:For i,1,100,step
: tempsum+i! tempsum
:EndFor
:Disp tempsum
©
Contents of
tempsum
after
execution:
5050
Contents of
tempsum
when
step
is changed to
2
:
2500
format() MATH/String menu
format(
expression
[
, formatString
]
) ⇒
string
Returns
expression
as a character string based on
the format template.
expression
must simplify to a number.
formatString
is
a string and must be in the form: “
F
[
n
]
”, “
S[
n
]
”,
“
E[
n
]
”, “
G[
n
][
c
]
”, where
[ ]
indicate optional portions.
F[
n
]
: Fixed format.
n
is the number of digits to
display after the decimal point.
S[
n
]
: Scientific format.
n
is the number of digits to
display after the decimal point.
E[
n
]
: Engineering format.
n
is the number of digits
after the first significant digit. The exponent is
adjusted to a multiple of three, and the decimal point
is moved to the right by zero, one, or two digits.
format(1.234567,"f3")
¸
"1.235"
format(1.234567,"s2")
¸
"1.23í 0"
format(1.234567,"e3")
¸
"1.235í 0"
format(1.234567,"g3")
¸
"1.235"
format(1234.567,"g3")
¸
"1,234.567"
format(1.234567,"g3,r:")
¸
"1:235"
G[
n
][
c
]
: Same as fixed format but also separates
digits to the left of the radix into groups of three.
c
specifies the group separator character and defaults
to a comma. If
c
is a period, the radix will be shown
as a comma.
[R
c
]
: Any of the above specifiers may be suffixed
with the
R
c
radix flag, where
c
is a single character
that specifies what to substitute for the radix point.
fPart() MATH/Number menu
fPart(
expression1
) ⇒
expression
fPart(
list1
) ⇒
list
fPart(
matrix1
) ⇒
matrix
Returns the fractional part of the argument.
For a list or matrix, returns the fractional parts of the
elements.
The argument can be a real or a complex number.
fPart(ë 1.234)
¸ ë.234
fPart({1, ë 2.3, 7.003})
¸
{0 ë.3 .003}