finally, Type{<: AbstractFloat}

This commit is contained in:
jacekpoz 2024-11-08 10:21:34 +01:00
parent bcbf579924
commit 3a46ee1ea0
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

12
l1/1.jl
View file

@ -9,9 +9,9 @@ Calculate the machine epsilon iteratively
for the given IEEE 754 floating point type.
# Arguments
- `T`: a floating point number type <: AbstractFloat
- `T`: the floating point type
"""
function macheps(T)
function macheps(T::Type{<: AbstractFloat})
one_T = one(T)
ret = one_T
while one_T + (ret / T(2)) > one_T
@ -28,9 +28,9 @@ Calculate the eta number iteratively
for the given IEEE 754 floating point type.
# Arguments
- `T`: a floating point number type <: AbstractFloat
- `T`: the floating point type
"""
function eta(T)
function eta(T::Type{<: AbstractFloat})
ret = one(T)
while ret / T(2) > zero(T)
@ -47,9 +47,9 @@ Calculate the largest possible value
for the given IEEE 754 floating type.
# Arguments
- `T`: a floating point number type <: AbstractFloat
- `T`: the floating point type
"""
function max(T)
function max(T::Type{<: AbstractFloat})
ret = one(T)
while isfinite(ret * T(2))