Graphics Reference
In-Depth Information
Table B-2
Exponential Functions
(continued)
Syntax
Description
genType
log2
(genType
angle
)
Returns the base 2 logarithm of
x
, i.e.,
returns the value
y
, which satisfies the
equation
x
= 2
y
.
Results are undefined if
x
<= 0.
genType
sqrt
(genType
x
)
Returns the positive square root of
x.
Results are undefined if
x
< 0.
genType
inversesqrt
(genType
x
)
Returns the reciprocal of the positive
square root of
x
.
Results are undefined if
x
<= 0.
Common functions all operate component-wise. The description shown
in Table B-3 is per component.
Table B-3
Common Functions
Syntax
Description
genType
abs
(genType
x
)
genIType
abs
(genIType
x
)
Returns
x
if
x >=
0; otherwise, it returns -
x
.
genType
sign
(genType
x
)
genIType
sign
(genIType
x
)
Returns 1.0 if
x >
0, 0.0 if
x =
0, or -1.0 if
x <
0.
genType
floor
(genType
x
)
Returns a value equal to the nearest
integer that is less than or equal to
x.
genType
trunc
(genType
x
)
Returns a value equal to the nearest
integer to
x
whose absolute value
is not larger than the absolute value
of
x
.
(continues)