Numeric Values
Type Predicates
-
(number?val) - Standard Scheme Procedure.
Determine if
valis a number. -
(integer?val) - Standard Scheme Procedure.
Determine whether
valis an integer. -
(rational?val) - Optional Scheme Procedure.
Determine whether
valcan be interpreted as a rational number. -
(real?val) - Standard Scheme Procedure.
Determine whether
valis a real number. -
(complex?val) - Optional Scheme Procedure.
Determine whether
valcan be interpreted as a complex number.
Extrema
-
(maxv1v2) - Standard Scheme Procedure.
Find the larger of
v1andv2. -
(maxv1v2...vn) - Standard Scheme Procedure.
Find the largest of
v1throughvn. -
(minv1v2) - Standard Scheme Procedure.
Find the smaller of
v1andv2. -
(minv1v2...vn) - Standard Scheme Procedure.
Find the smallest of
v1throughvn.
Division-Related Procedures
-
(quotientdividenddivisor) - Standard Scheme Procedure.
Find the quotient of
dividendanddivisor, both of which must be integers. The quotient is the whole part of the result of dividingdividendbydivisor. -
(remainderdividenddivisor) - Standard Scheme Procedure.
Compute the remainder after doing whole-number division of
dividendbydivisor. -
(modulovaluemodulus) - Standard Scheme Procedure.
In a number line segmented into
modulus-sized sections, gives the offset ofvaluefrom the start of its section.
Converting Reals to Integers
-
(floornum) - Standard Scheme Procedure.
Find the largest integer less than or equal to
num. That is, round down. -
(ceilingnum) - Standard Scheme Procedure.
Find the smallest integer greater than or equal to
num. That is, round up. -
(truncatenum) - Standard Scheme Procedure.
Remove any fractional part from
num. That is, round toward zero. -
(roundnum) - Standard Scheme Procedure.
Round
numtoward the nearest integer. If the decimal portion ofnumis greater than 1/2, rounds up. If the decimal portion is less than 1/2, rounds down. If the decimal portion equals 1/2, may round in either direction. (In most implementations, numbers with fractional portions equal to 1/2 round toward the even number.)
Other Predicates
-
(exact?num) - Standard Scheme Procedure.
Determine whether the numeric value
numis represented exactly (that is, not approximated). -
(inexact?num) - Standard Scheme Procedure.
Determine whether the numeric value
numis represented inexactly (that is, approximated). -
(even?int) - Standard Scheme Procedure.
Determine whether the integer value
intis even (that is, has a remainder of 0 when divided by 2). -
(odd?int) - Standard Scheme Procedure.
Determine whether the integer value
intis odd (that is, has a remainder of 1 when divided by 2). -
(zero?num) - Standard Scheme Procedure.
Determine whether the numeric value
numis zero. -
(positive?num) - Standard Scheme Procedure.
Determine whether the numeric value
numis positive (greater than zero). -
(negative?num) - Standard Scheme Procedure.
Determine whether the numeric value
numis negative (less than zero).
Converting Representations
-
(exact->inexactnum) - Standard Scheme Procedure.
Create an inexact representation of
num. -
(inexact->exactnum) - Standard Scheme Procedure.
Create an exact representation of
num. (Of course, ifnumwas already approximated, the result, while exact, still approximates whatevernumapproximated.)
Other Procedures
-
(absnum) - Standard Scheme Procedure.
Compute the absolute value of
num. -
(exptbasepower) - Standard Scheme Procedure.
Compute
basepower.