FloatUnitο
- class bapsflib.plasma.core.FloatUnit(value, cgs_unit)ο
Bases:
floatTemplate class for floats with a unit attribute.
- Parameters:
- Returns:
value of constant
- Return type:
Attributes Summary
the imaginary part of a complex number
the real part of a complex number
units of constant
Methods Summary
Return a pair of integers, whose ratio is exactly equal to the original float.
Return self, the complex conjugate of any float.
from_number(number,Β /)Convert real number to a floating-point number.
fromhex(string,Β /)Create a floating-point number from a hexadecimal string.
hex()Return a hexadecimal representation of a floating-point number.
Return True if the float is an integer.
Attributes Documentation
- imagο
the imaginary part of a complex number
- realο
the real part of a complex number
- unitο
units of constant
Methods Documentation
- as_integer_ratio()ο
Return a pair of integers, whose ratio is exactly equal to the original float.
The ratio is in lowest terms and has a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs.
>>> (10.0).as_integer_ratio() (10, 1) >>> (0.0).as_integer_ratio() (0, 1) >>> (-.25).as_integer_ratio() (-1, 4)
- conjugate()ο
Return self, the complex conjugate of any float.
- classmethod from_number(number, /)ο
Convert real number to a floating-point number.
- classmethod fromhex(string, /)ο
Create a floating-point number from a hexadecimal string.
>>> float.fromhex('0x1.ffffp10') 2047.984375 >>> float.fromhex('-0x1p-1074') -5e-324
- hex()ο
Return a hexadecimal representation of a floating-point number.
>>> (-0.1).hex() '-0x1.999999999999ap-4' >>> 3.14159.hex() '0x1.921f9f01b866ep+1'
- is_integer()ο
Return True if the float is an integer.