__float__¶
- array.__float__() float ¶
Converts a zero-dimensional array to a Python
float
object.Note
Casting integer values outside the representable bounds of Python’s float type is not specified and is implementation-dependent.
- Parameters:
self (array) – zero-dimensional array instance. Should have a real-valued or boolean data type. If
self
has a complex floating-point data type, the function must raise aTypeError
.- Returns:
out (float) – a Python
float
object representing the single element of the array instance.
Notes
Special cases
For boolean operands,
If
self
isTrue
, the result is1
.If
self
isFalse
, the result is0
.
Changed in version 2022.12: Added boolean and complex data type support.