### Section 7.1.8Functions

POV-Ray defines a variety of built-in functions for manipulating floats, vectors and strings. The functions are listed grouped according to their usage and not by the type of value they return. For example vdot computes the dot product of two vectors and is listed as a vector function even though it returns a single float value.

Function calls consist of a keyword which specifies the name of the function followed by a parameter list enclosed in parentheses. Parameters are separated by commas. For example:

keyword(param1,param2)

Functions evaluate to values that are floats, vectors or strings and may be used in expressions or statements anywhere that literals or identifiers of that type may be used.

### Section 7.1.8.1Float Functions

The following are the functions which take one or more float parameters and return float values. Assume that A and B are any valid expression that evaluates to a float. See section "Vector Functions" and section "String Functions" for other functions which return float values but whose primary purpose is more closely related to vectors and strings.

#declare R1 = seed(0) #declare R2 = seed(12345) #sphere { <rand(R1), rand(R1), rand(R1)>, rand(R2) }

Multiple random generators are very useful in situations where you use rand() to place a group of objects, and then decide to use rand() in another location earlier in the file to set some colors or place another group of objects. Without separate rand() streams, all of your objects would move when you added more calls to rand(). This is very annoying.

### Section 7.1.8.2Vector Functions

The following are the functions which take one or more vector and float parameters and return vector or float values. All of these functions support only three component vectors. Assume that A and B are any valid expression that evaluates to a three component vector and that F is any valid expression that evaluates to a float.

### Section 7.1.8.3String Functions

The following are the functions which take one or more string and float parameters and return string or float values. Assume that S1 and S2 are any valid strings and that A, L and P are any valid expressions that evaluate to floats.

concat("Value is ", str(A,3,1), " inches")

If the float value A was 12.34 the result is "Value is 12.3 inches" which is a string.

The float parameter P specifies the number of digits after the decimal point. If P is negative then a compiler-specific default precision is use. Here are some examples:

```  str(123.456,0,3)   "123.456"
str(123.456,4,3)   "123.456"
str(123.456,9,3)   "  123.456"
str(123.456,-9,3)  "00123.456"
str(123.456,0,2)   "123.46"
str(123.456,0,0)   "123"
str(123.456,5,0)   "  123"
str(123.000,7,2)   " 123.00"
str(123.456,0,-1)  "123.456000" (platform specific)
```

Next Section