types

float

Floating-point numbers and the methods available on them.

A float is a floating-point number. As a schema field it is written rate: float, and a literal has a decimal point, as in 3.14. For money, use decimal instead, which is exact.

marreta
price = 3.14159
rounded = price.round(2)

Methods

NameSignatureSummary
float.absabs()Returns the absolute value.
float.roundround(places)Rounds to the given number of places.
float.ceilceil()Rounds up.
float.floorfloor()Rounds down.
float.minmin(other)Returns the smaller value.
float.maxmax(other)Returns the larger value.
float.to_stringto_string()Converts to a string.