Previous:Comments Main Index Next:Float Literals
Many parts of the POV-Ray language require you to specify one or more floating point numbers. A floating point number is a number with a decimal point. Floats may be specified using literals, identifiers or functions which return float values. You may also create very complex float expressions from combinations of any of these using various familiar operators.
Where POV-Ray needs an integer value it allows you to specify a float value and it truncates it to an integer. When POV-Ray needs a logical or boolean value it interprets any non-zero float as true and zero as false. Because float comparisons are subject to rounding errors POV-Ray accepts values extremely close to zero as being false when doing boolean functions. Typically values whose absolute values are less than a preset value epsilon are considered false for logical expressions. The value of epsilon is system dependent but is generally about 1.0e-10. Two floats a and b are considered to be equal if abs(a-b) < epsilon.
The full syntax for float expressions is given below. Detailed explanations are given in the following sub-sections.
+
| -
*
| /
(
FULL_EXPRESSION )
|
!
NUMERIC_FACTOR |
0
| 1
| 2
| 3
| 4
| 5
| 6
| 7
| 8
| 9
.
e
| E
x
| y
| z
| t
| u
| v
| red
| blue
| green
| filter
| transmit
abs(
FLOAT )
| acos(
FLOAT )
| val(
STRING )
| asc(
STRING )
|
asin(
FLOAT )
| atan2(
FLOAT ,
FLOAT )
| ceil(
FLOAT )
| cos(
FLOAT )
|
defined(
IDENTIFIER )
| degrees(
FLOAT )
| div(
FLOAT ,
FLOAT )
| exp(
FLOAT )
|
file_exists(
STRING )
| floor(
FLOAT )
| int(
FLOAT )
| log(
FLOAT )
|
max(
FLOAT ,
FLOAT )
| min(
FLOAT ,
FLOAT )
| mod(
FLOAT ,
FLOAT )
|
pow(
FLOAT ,
FLOAT )
| radians(
FLOAT )
| sin(
FLOAT )
| sqrt(
FLOAT )
|
strcmp(
STRING ,
STRING )
| strlen(
STRING )
| tan(
FLOAT )
|
vdot(
VECTOR ,
VECTOR )
| vlength(
VECTOR )
| seed(
FLOAT )
| rand(
FLOAT )
|
dimensions(
ARRAY_IDENTIFIER )
| dimension_size(
ARRAY_IDENTIFIER ,
FLOAT )
clock
| pi
| version
| true
| yes
| on
| false
| no
|
off
| clock_delta
?
FULL_EXPRESSION :
FULL_EXPRESSION]
&
| |
(note this means an ampersand or a vertical bar is a logical operator)
<
| <=
| =
| >=
| >
| !=
Note: FLOAT_IDENTIFIERS are identifiers previously declared to have float values. The DOT_ITEM syntax is actually a vector or color operator but it returns a float value. See "Vector Operators" or "Color Operators" for details. An ARRAY_IDENTIFIER is just the identifier name of a previously declared array, it does not include the []
braces nor the index. The syntax for STRING is in the section "Strings".
Previous:Comments Main Index Next:Float Literals