more type fixes for abstract float
This commit is contained in:
parent
3a46ee1ea0
commit
929cdd9ef3
2 changed files with 6 additions and 6 deletions
6
l1/1.jl
6
l1/1.jl
|
@ -3,7 +3,7 @@
|
||||||
# Jacek Poziemski 272389
|
# Jacek Poziemski 272389
|
||||||
|
|
||||||
"""
|
"""
|
||||||
macheps(T)
|
macheps(T::Type{<: AbstractFloat})
|
||||||
|
|
||||||
Calculate the machine epsilon iteratively
|
Calculate the machine epsilon iteratively
|
||||||
for the given IEEE 754 floating point type.
|
for the given IEEE 754 floating point type.
|
||||||
|
@ -22,7 +22,7 @@ function macheps(T::Type{<: AbstractFloat})
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
eta(T)
|
eta(T::Type{<: AbstractFloat})
|
||||||
|
|
||||||
Calculate the eta number iteratively
|
Calculate the eta number iteratively
|
||||||
for the given IEEE 754 floating point type.
|
for the given IEEE 754 floating point type.
|
||||||
|
@ -41,7 +41,7 @@ function eta(T::Type{<: AbstractFloat})
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
max(T)
|
max(T::Type{<: AbstractFloat})
|
||||||
|
|
||||||
Calculate the largest possible value
|
Calculate the largest possible value
|
||||||
for the given IEEE 754 floating type.
|
for the given IEEE 754 floating type.
|
||||||
|
|
6
l1/2.jl
6
l1/2.jl
|
@ -3,15 +3,15 @@
|
||||||
# Jacek Poziemski 272389
|
# Jacek Poziemski 272389
|
||||||
|
|
||||||
"""
|
"""
|
||||||
kahanmacheps(T)
|
kahanmacheps(T::Type{<: AbstractFloat})
|
||||||
|
|
||||||
Calculate the Kahan machine epsilon
|
Calculate the Kahan machine epsilon
|
||||||
using the following expression: `3(4/3 - 1) - 1`.
|
using the following expression: `3(4/3 - 1) - 1`.
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
- `T`: a floating point number type <: AbstractFloat
|
- `T`: the floating point type
|
||||||
"""
|
"""
|
||||||
function kahanmacheps(T)
|
function kahanmacheps(T::Type{<: AbstractFloat})
|
||||||
return T(3) * ((T(4) / T(3)) - one(T)) - one(T)
|
return T(3) * ((T(4) / T(3)) - one(T)) - one(T)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue