Search notes:

Python: float

Members

as_integer_ratio() Returns a tuple with two elements: numerator and denominator
conjugate()
fromhex() An instance method that creates a float from a hexadecimal representation as returned by hex()
hex()
imag Always evaluates to 0.0 (See CPython source code for floats, float_getimag). This member seems to be present so that both, floats and complex objects can be passed to a function that evaluates .imag.
is_integer() True if the instance is finite and has an integral value.
real See imag

Misc

>>> x = 3.141
>>> x.hex()
'0x1.920c49ba5e354p+1'

>>> y = float.fromhex('0x1.920c49ba5e354p+1')
>>> y
3.141
not_a_number = float('NaN')
infinite     = float('inf')

See also

sys.float_info and sys.float_repr_style.
Other Built-in types, such as int
The ptyhon module mpmath provides arbitrary precision real and compleas floating-point arithmetics.
The standard library modules fractions and decimal.
IEEE-754 (Floating Point Arithmetic - float/double etc)

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758198429, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/types/float(74): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78