:right-sidebar: True Float =================================================================== .. currentmodule:: gi.repository.GObject .. class:: Float(*args, **kwargs) :no-contents-entry: A wrapper to force conversion to G_TYPE_FLOAT instead of G_TYPE_DOUBLE when used in GValue APIs. Methods ------- .. rst-class:: interim-class .. class:: Float :no-index: .. method:: 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) .. method:: conjugate() Return self, the complex conjugate of any float. .. method:: fromhex(string, /) Create a floating-point number from a hexadecimal string. >>> float.fromhex('0x1.ffffp10') 2047.984375 >>> float.fromhex('-0x1p-1074') -5e-324 :param string: .. method:: hex() Return a hexadecimal representation of a floating-point number. >>> (-0.1).hex() '-0x1.999999999999ap-4' >>> 3.14159.hex() '0x1.921f9f01b866ep+1' .. method:: is_integer() Return True if the float is an integer. Fields ------ .. rst-class:: interim-class .. class:: Float :no-index: .. attribute:: imag The imaginary part of a complex number .. attribute:: real The real part of a complex number