Float built-in type.


Float built-in type.


floatfloat ( bool from )
floatfloat ( int from )
floatfloat ( String from )

Method Descriptions

Cast a bool value to a floating-point value, float(true) will be equal to 1.0 and float(false) will be equal to 0.0.

Cast an int value to a floating-point value, float(1) will be equal to 1.0.

Cast a String value to a floating-point value. This method accepts float value strings like "1.23" and exponential notation strings for its parameter so calling float("1e3") will return 1000.0 and calling float("1e-3") will return 0.001. Calling this method with an invalid float string will return 0. This method stops parsing at the first invalid character and will return the parsed result so far, so calling float("1a3") will return 1 while calling float("1e3a2") will return 1000.0.

Doc ID missing

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 1970-01-01 at 00:00:00. It’s the English Stable version because it’s what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.