finally, Type{<: AbstractFloat}
This commit is contained in:
parent
bcbf579924
commit
3a46ee1ea0
1 changed files with 6 additions and 6 deletions
12
l1/1.jl
12
l1/1.jl
|
@ -9,9 +9,9 @@ Calculate the machine epsilon iteratively
|
||||||
for the given IEEE 754 floating point type.
|
for the given IEEE 754 floating point type.
|
||||||
|
|
||||||
# Arguments
|
# 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)
|
one_T = one(T)
|
||||||
ret = one_T
|
ret = one_T
|
||||||
while one_T + (ret / T(2)) > 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.
|
for the given IEEE 754 floating point type.
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
- `T`: a floating point number type <: AbstractFloat
|
- `T`: the floating point type
|
||||||
"""
|
"""
|
||||||
function eta(T)
|
function eta(T::Type{<: AbstractFloat})
|
||||||
ret = one(T)
|
ret = one(T)
|
||||||
|
|
||||||
while ret / T(2) > zero(T)
|
while ret / T(2) > zero(T)
|
||||||
|
@ -47,9 +47,9 @@ Calculate the largest possible value
|
||||||
for the given IEEE 754 floating type.
|
for the given IEEE 754 floating type.
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
- `T`: a floating point number type <: AbstractFloat
|
- `T`: the floating point type
|
||||||
"""
|
"""
|
||||||
function max(T)
|
function max(T::Type{<: AbstractFloat})
|
||||||
ret = one(T)
|
ret = one(T)
|
||||||
|
|
||||||
while isfinite(ret * T(2))
|
while isfinite(ret * T(2))
|
||||||
|
|
Loading…
Reference in a new issue