Skip to main content

float

Standard library class internal.core.float View source
class float
@tuple
class float
Constructors 9
__new__
__new__() -> float
__new__
@overload
__new__(what, /) -> float
__new__
__new__(what, /) -> float
Added by internal.ops
__new__
__new__(what: bool, /) -> float
Added by internal.ops
__new__
@pure @llvm
__new__[N: Literal[int]](what: Int[N], /) -> float
Added by internal.ops
%0 = sitofp i{=N} %what to double
ret double %0
__new__
@pure @llvm
__new__[N: Literal[int]](what: UInt[N], /) -> float
Added by internal.ops
%0 = uitofp i{=N} %what to double
ret double %0
__new__
@pure @llvm
__new__(what: float32, /) -> float
Added by internal.ops
%0 = fpext float %what to double
ret double %0
__new__
@pure @llvm
__new__(what: float16, /) -> float
Added by internal.ops
%0 = fpext half %what to double
ret double %0
__new__
@pure @llvm
__new__(what: bfloat16, /) -> float
Added by internal.ops
%0 = fpext bfloat %what to double
ret double %0
Properties 2
real
@property
real(self: Self) -> float
imag
@property
imag(self: Self) -> float
Methods 2
cdiv
cdiv(self: Self, other: float) -> float
cmod
cmod(self: Self, other: float) -> float
Special methods 47
__repr__
__repr__(self: Self, /) -> str
__copy__
__copy__(self: Self) -> float
__deepcopy__
__deepcopy__(self: Self) -> float
__int__
@pure @llvm
__int__(self: Self, /) -> int
%0 = fptosi double %self to i64
ret i64 %0
__float__
__float__(self: Self, /) -> float
__bool__
@pure @llvm
__bool__(self: Self, /) -> bool
%0 = fcmp une double %self, 0.000000e+00
%1 = zext i1 %0 to i8
ret i8 %1
__pos__
__pos__(self: Self, /) -> float
__neg__
@pure @llvm
__neg__(self: Self, /) -> float
%0 = fneg double %self
ret double %0
__add__
@commutative
@pure @llvm
__add__(a: float, b: float, /) -> float
%tmp = fadd double %a, %b
ret double %tmp
__add__(self: Self, b: float128, /)
Added by internal.ops
__add__(self: Self, b: float32, /)
Added by internal.ops
__add__(self: Self, b: float16, /)
Added by internal.ops
__add__(self: Self, b: bfloat16, /)
Added by internal.ops
__add__(self: Self, b: Int, /)
Added by internal.ops
__add__(self: Self, b: UInt, /)
Added by internal.ops
__add__(self: Self, b: bool, /)
Added by internal.ops
__sub__
@pure @llvm
__sub__(a: float, b: float, /) -> float
%tmp = fsub double %a, %b
ret double %tmp
__sub__(self: Self, b: float128, /)
Added by internal.ops
__sub__(self: Self, b: float32, /)
Added by internal.ops
__sub__(self: Self, b: float16, /)
Added by internal.ops
__sub__(self: Self, b: bfloat16, /)
Added by internal.ops
__sub__(self: Self, b: Int, /)
Added by internal.ops
__sub__(self: Self, b: UInt, /)
Added by internal.ops
__sub__(self: Self, b: bool, /)
Added by internal.ops
__mul__
@commutative
@pure @llvm
__mul__(a: float, b: float, /) -> float
%tmp = fmul double %a, %b
ret double %tmp
__mul__(self: Self, b: float128, /)
Added by internal.ops
__mul__(self: Self, b: float32, /)
Added by internal.ops
__mul__(self: Self, b: float16, /)
Added by internal.ops
__mul__(self: Self, b: bfloat16, /)
Added by internal.ops
__mul__(self: Self, b: Int, /)
Added by internal.ops
__mul__(self: Self, b: UInt, /)
Added by internal.ops
__mul__(self: Self, b: bool, /)
Added by internal.ops
__floordiv__
__floordiv__(self: Self, other: float, /) -> float
__floordiv__(self: Self, b: float128, /)
Added by internal.ops
__floordiv__(self: Self, b: float32, /)
Added by internal.ops
__floordiv__(self: Self, b: float16, /)
Added by internal.ops
__floordiv__(self: Self, b: bfloat16, /)
Added by internal.ops
__floordiv__(self: Self, b: Int, /)
Added by internal.ops
__floordiv__(self: Self, b: UInt, /)
Added by internal.ops
__floordiv__(self: Self, b: bool, /)
Added by internal.ops
__truediv__
__truediv__(self: Self, other: float, /) -> float
__truediv__(self: Self, b: float128, /)
Added by internal.ops
__truediv__(self: Self, b: float32, /)
Added by internal.ops
__truediv__(self: Self, b: float16, /)
Added by internal.ops
__truediv__(self: Self, b: bfloat16, /)
Added by internal.ops
__truediv__(self: Self, b: Int, /)
Added by internal.ops
__truediv__(self: Self, b: UInt, /)
Added by internal.ops
__truediv__(self: Self, b: bool, /)
Added by internal.ops
__mod__
__mod__(self: Self, other: float, /) -> float
__mod__(self: Self, b: float128, /)
Added by internal.ops
__mod__(self: Self, b: float32, /)
Added by internal.ops
__mod__(self: Self, b: float16, /)
Added by internal.ops
__mod__(self: Self, b: bfloat16, /)
Added by internal.ops
__mod__(self: Self, b: Int, /)
Added by internal.ops
__mod__(self: Self, b: UInt, /)
Added by internal.ops
__mod__(self: Self, b: bool, /)
Added by internal.ops
__divmod__
__divmod__(self: Self, other: float, /) -> Tuple[(float, float)]
__divmod__(self: Self, b: float128, /)
Added by internal.ops
__divmod__(self: Self, b: float32, /)
Added by internal.ops
__divmod__(self: Self, b: float16, /)
Added by internal.ops
__divmod__(self: Self, b: bfloat16, /)
Added by internal.ops
__divmod__(self: Self, b: Int, /)
Added by internal.ops
__divmod__(self: Self, b: UInt, /)
Added by internal.ops
__divmod__(self: Self, b: bool, /)
Added by internal.ops
__eq__
@pure @llvm
__eq__(a: float, b: float, /) -> bool
%tmp = fcmp oeq double %a, %b
%res = zext i1 %tmp to i8
ret i8 %res
__eq__(self: Self, b: float128, /)
Added by internal.ops
__eq__(self: Self, b: float32, /)
Added by internal.ops
__eq__(self: Self, b: float16, /)
Added by internal.ops
__eq__(self: Self, b: bfloat16, /)
Added by internal.ops
__eq__(self: Self, b: Int, /)
Added by internal.ops
__eq__(self: Self, b: UInt, /)
Added by internal.ops
__eq__(self: Self, b: bool, /)
Added by internal.ops
__ne__
@pure @llvm
__ne__(a: float, b: float, /) -> bool
%tmp = fcmp une double %a, %b
%res = zext i1 %tmp to i8
ret i8 %res
__ne__(self: Self, b: float128, /)
Added by internal.ops
__ne__(self: Self, b: float32, /)
Added by internal.ops
__ne__(self: Self, b: float16, /)
Added by internal.ops
__ne__(self: Self, b: bfloat16, /)
Added by internal.ops
__ne__(self: Self, b: Int, /)
Added by internal.ops
__ne__(self: Self, b: UInt, /)
Added by internal.ops
__ne__(self: Self, b: bool, /)
Added by internal.ops
__lt__
@pure @llvm
__lt__(a: float, b: float, /) -> bool
%tmp = fcmp olt double %a, %b
%res = zext i1 %tmp to i8
ret i8 %res
__lt__(self: Self, b: float128, /)
Added by internal.ops
__lt__(self: Self, b: float32, /)
Added by internal.ops
__lt__(self: Self, b: float16, /)
Added by internal.ops
__lt__(self: Self, b: bfloat16, /)
Added by internal.ops
__lt__(self: Self, b: Int, /)
Added by internal.ops
__lt__(self: Self, b: UInt, /)
Added by internal.ops
__lt__(self: Self, b: bool, /)
Added by internal.ops
__gt__
@pure @llvm
__gt__(a: float, b: float, /) -> bool
%tmp = fcmp ogt double %a, %b
%res = zext i1 %tmp to i8
ret i8 %res
__gt__(self: Self, b: float128, /)
Added by internal.ops
__gt__(self: Self, b: float32, /)
Added by internal.ops
__gt__(self: Self, b: float16, /)
Added by internal.ops
__gt__(self: Self, b: bfloat16, /)
Added by internal.ops
__gt__(self: Self, b: Int, /)
Added by internal.ops
__gt__(self: Self, b: UInt, /)
Added by internal.ops
__gt__(self: Self, b: bool, /)
Added by internal.ops
__le__
@pure @llvm
__le__(a: float, b: float, /) -> bool
%tmp = fcmp ole double %a, %b
%res = zext i1 %tmp to i8
ret i8 %res
__le__(self: Self, b: float128, /)
Added by internal.ops
__le__(self: Self, b: float32, /)
Added by internal.ops
__le__(self: Self, b: float16, /)
Added by internal.ops
__le__(self: Self, b: bfloat16, /)
Added by internal.ops
__le__(self: Self, b: Int, /)
Added by internal.ops
__le__(self: Self, b: UInt, /)
Added by internal.ops
__le__(self: Self, b: bool, /)
Added by internal.ops
__ge__
@pure @llvm
__ge__(a: float, b: float, /) -> bool
%tmp = fcmp oge double %a, %b
%res = zext i1 %tmp to i8
ret i8 %res
__ge__(self: Self, b: float128, /)
Added by internal.ops
__ge__(self: Self, b: float32, /)
Added by internal.ops
__ge__(self: Self, b: float16, /)
Added by internal.ops
__ge__(self: Self, b: bfloat16, /)
Added by internal.ops
__ge__(self: Self, b: Int, /)
Added by internal.ops
__ge__(self: Self, b: UInt, /)
Added by internal.ops
__ge__(self: Self, b: bool, /)
Added by internal.ops
__abs__
@pure @llvm
__abs__(a: float, /) -> float
declare double @llvm.fabs.f64(double %a)
%tmp = call double @llvm.fabs.f64(double %a)
ret double %tmp
__floor__
@pure @llvm
__floor__(a: float, /) -> float
declare double @llvm.floor.f64(double %a)
%tmp = call double @llvm.floor.f64(double %a)
ret double %tmp
__ceil__
@pure @llvm
__ceil__(a: float, /) -> float
declare double @llvm.ceil.f64(double %a)
%tmp = call double @llvm.ceil.f64(double %a)
ret double %tmp
__trunc__
@pure @llvm
__trunc__(a: float, /) -> float
declare double @llvm.trunc.f64(double %a)
%tmp = call double @llvm.trunc.f64(double %a)
ret double %tmp
__pow__
@pure @llvm
__pow__(a: float, b: float, /) -> float
declare double @llvm.pow.f64(double %a, double %b)
%tmp = call double @llvm.pow.f64(double %a, double %b)
ret double %tmp
__pow__(self: Self, b: float128, /)
Added by internal.ops
__pow__(self: Self, b: float32, /)
Added by internal.ops
__pow__(self: Self, b: float16, /)
Added by internal.ops
__pow__(self: Self, b: bfloat16, /)
Added by internal.ops
__pow__(self: Self, b: Int, /)
Added by internal.ops
__pow__(self: Self, b: UInt, /)
Added by internal.ops
__pow__(self: Self, b: bool, /)
Added by internal.ops
__round__
__round__(self: Self, ndigits = None, /)
__atomic_xchg__
@nocapture @llvm
__atomic_xchg__(d: Ptr[float], b: float) -> None
%tmp = atomicrmw xchg ptr %d, double %b seq_cst
ret {} {}
__atomic_add__
@nocapture @llvm
__atomic_add__(d: Ptr[float], b: float) -> float
0:
%1 = load atomic i64, ptr %d monotonic, align 8
%2 = bitcast i64 %1 to double
%3 = fadd double %2, %b
%4 = bitcast double %3 to i64
%5 = cmpxchg weak ptr %d, i64 %1, i64 %4 seq_cst monotonic, align 8
%6 = extractvalue { i64, i1 } %5, 1
br i1 %6, label %15, label %7
7: ; preds = %0, %7
%8 = phi { i64, i1 } [ %13, %7 ], [ %5, %0 ]
%9 = extractvalue { i64, i1 } %8, 0
%10 = bitcast i64 %9 to double
%11 = fadd double %10, %b
%12 = bitcast double %11 to i64
%13 = cmpxchg weak ptr %d, i64 %9, i64 %12 seq_cst monotonic, align 8
%14 = extractvalue { i64, i1 } %13, 1
br i1 %14, label %15, label %7
15: ; preds = %7, %0
%16 = phi double [ %2, %0 ], [ %10, %7 ]
ret double %16
__atomic_sub__
@nocapture @llvm
__atomic_sub__(d: Ptr[float], b: float) -> float
0:
%1 = load atomic i64, ptr %d monotonic, align 8
%2 = bitcast i64 %1 to double
%3 = fsub double %2, %b
%4 = bitcast double %3 to i64
%5 = cmpxchg weak ptr %d, i64 %1, i64 %4 seq_cst monotonic, align 8
%6 = extractvalue { i64, i1 } %5, 1
br i1 %6, label %15, label %7
7: ; preds = %0, %7
%8 = phi { i64, i1 } [ %13, %7 ], [ %5, %0 ]
%9 = extractvalue { i64, i1 } %8, 0
%10 = bitcast i64 %9 to double
%11 = fsub double %10, %b
%12 = bitcast double %11 to i64
%13 = cmpxchg weak ptr %d, i64 %9, i64 %12 seq_cst monotonic, align 8
%14 = extractvalue { i64, i1 } %13, 1
br i1 %14, label %15, label %7
15: ; preds = %7, %0
%16 = phi double [ %2, %0 ], [ %10, %7 ]
ret double %16
__hash__
__hash__(self: Self, /) -> int
__match__
__match__(self: Self, obj: float) -> bool
__suffix_f32__
__suffix_f32__(double) -> float32
__suffix_f16__
__suffix_f16__(double) -> float16
__suffix_bf16__
__suffix_bf16__(double) -> bfloat16
__suffix_f128__
__suffix_f128__(double) -> float128
__suffix_j__
__suffix_j__(x: float) -> complex
__complex__
__complex__(self: Self) -> complex
__str__
__str__(self: Self, /) -> str
__format__
__format__(self: Self, format_spec: str, /) -> str
__to_gpu__
__to_gpu__(self: Self, cache: AllocCache)
Added by internal.gpu
__from_gpu__
__from_gpu__(self: Self, other: float)
Added by internal.gpu
__from_gpu_new__
__from_gpu_new__(other: float)
Added by internal.gpu
__pickle__
__pickle__(self: Self, jar: Jar)
Added by pickle
__unpickle__
__unpickle__(jar: Jar) -> float
Added by pickle
__to_py__
__to_py__(self: Self) -> cobj
__from_py__
__from_py__(d: cobj) -> float