float :: Class float

# type float

    object --+
             |
            float

float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

Instance Methods

__abs__(x) abs(x) |

__add__(x, y) x+y |

__coerce__(x, y) coerce(x, y) |

__div__(x, y) x/y |

__divmod__(x, y) divmod(x, y) |

__eq__(x, y) x==y |

__float__(x) float(x) |

__floordiv__(x, y) x//y |

__ge__(x, y) x>=y |

__getattribute__(...) x.__getattribute__('name') <==> x.name |

string

__getformat__(float, typestr) You probably don't want to use this function. |

__getnewargs__(...) |

__gt__(x, y) x>y |

__hash__(x) hash(x) |

__int__(x) int(x) |

__le__(x, y) x<=y |

__long__(x) long(x) |

__lt__(x, y) x<y |

__mod__(x, y) x%y |

__mul__(x, y) x*y |

__ne__(x, y) x!=y |

__neg__(x) -x |

a new object with type S, a subtype of T

__new__(T, S, ...) |

__nonzero__(x) x != 0 |

__pos__(x) +x |

__pow__(x, y, z=...) pow(x, y[, z]) |

__radd__(x, y) y+x |

__rdiv__(x, y) y/x |

__rdivmod__(x, y) divmod(y, x) |

__repr__(x) repr(x) |

__rfloordiv__(x, y) y//x |

__rmod__(x, y) y%x |

__rmul__(x, y) y*x |

__rpow__(y, x, z=...) pow(x, y[, z]) |

__rsub__(x, y) y-x |

__rtruediv__(x, y) y/x |

None

__setformat__(float, typestr, fmt) You probably don't want to use this function. |

__str__(x) str(x) |

__sub__(x, y) x-y |

__truediv__(x, y) x/y |

Method Details

### __getattribute__(...)

x.__getattribute__('name') <==> x.name

Overrides: object.__getattribute__

### __getformat__(float, typestr)

You probably don't want to use this function. It exists mainly to be used in Python's test suite.

typestr must be 'double' or 'float'. This function returns whichever of 'unknown', 'IEEE, big-endian' or 'IEEE, little-endian' best describes the format of floating point numbers used by the C type named by typestr.

Returns: string

### __hash__(x)
(Hashing function)

hash(x)

Overrides: object.__hash__

### __new__(T, S, ...)

Returns: a new object with type S, a subtype of T
Overrides: object.__new__

### __repr__(x)
(Representation operator)

repr(x)

Overrides: object.__repr__

### __setformat__(float, typestr, fmt)

You probably don't want to use this function. It exists mainly to be used in Python's test suite.

typestr must be 'double' or 'float'. fmt must be one of 'unknown', 'IEEE, big-endian' or 'IEEE, little-endian', and in addition can only be one of the latter two if it appears to match the underlying C reality.

Overrides the automatic determination of C-level floating point type. This affects how floats are converted to and from binary strings.

Returns: None

### __str__(x)
(Informal representation operator)

str(x)

Overrides: object.__str__