[−][src]Static p5_sys::global::float
pub static float: FloatInternalType
Converts a string to its floating point representation. 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 values is passed in, then an array of floats of the same length is returned.
Examples
let str = '20'; let diameter = float(str); ellipse(width / 2, height / 2, diameter, diameter);
print(float('10.31')); // 10.31
print(float('Infinity')); // Infinity
print(float('-Infinity')); // -Infinity
Parameters
str
float string to parse