This documentation was generated from
the Python documentation available by typing help(float) in the Python shell. In this
documentation at least one of the variables x and y refer to floats
(Table 9.1).
Table
9.1
Float operators
Operator
|
Returns
|
Comments
|
---|---|---|
x
![]() |
float
|
Returns the sum of x and y
|
x
![]() |
float
|
Returns the difference of x and y
|
x*y
|
float
|
Returns the product of x and y
|
x/y
|
float
|
Returns the quotient of x divided by
y
|
x//y
|
float
|
Returns the quotient of integer division of
x divided by y. However, the result is still a float
|
x % y
|
float
|
Returns x modulo y. This is the remainder
of dividing x by y
|
abs(x)
|
int
|
Returns the absolute value of x
|
divmod(x, y)
|
(q,r)
|
Returns the quotient q and the remainder r
as a tuple. Both q and r are floats, but integer division is
performed. The value r is the whole and fractional part of any
remainder. The value q is a whole number
|
float(x)
|
float
|
Returns the float representation of x
|
int(x)
|
int
|
Returns the floor of x as an integer
|
pow(x, y)
|
float
|
Returns x to the y power
|
repr(x)
|
str
|
Returns a string representation of x
|
str(x)
|
str
|
Returns a string representation of x
|