This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.
Name | float() |
---|---|
Examples | int i = 65; float f = float(i); println(i + " : " + f); // Prints "65 : 65.0" |
Description |
Converts an int or String to its floating point representation. An int is easily converted to a float, but the contents of a String must resemble a number, or NaN (not a number) will be returned. For example, float("1234.56") evaluates to 1234.56, but float("giraffe") will return NaN. When an array of int or String values is passed in, then a floating point array of the same length is returned. |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.