diff --git a/l1/1.jl b/l1/1.jl index 0c53aa9..ca50d29 100755 --- a/l1/1.jl +++ b/l1/1.jl @@ -3,7 +3,7 @@ # Jacek Poziemski 272389 """ - macheps(T) + macheps(T::Type{<: AbstractFloat}) Calculate the machine epsilon iteratively for the given IEEE 754 floating point type. @@ -22,7 +22,7 @@ function macheps(T::Type{<: AbstractFloat}) end """ - eta(T) + eta(T::Type{<: AbstractFloat}) Calculate the eta number iteratively for the given IEEE 754 floating point type. @@ -41,7 +41,7 @@ function eta(T::Type{<: AbstractFloat}) end """ - max(T) + max(T::Type{<: AbstractFloat}) Calculate the largest possible value for the given IEEE 754 floating type. diff --git a/l1/2.jl b/l1/2.jl index 3c282a8..09ea4ff 100755 --- a/l1/2.jl +++ b/l1/2.jl @@ -3,15 +3,15 @@ # Jacek Poziemski 272389 """ - kahanmacheps(T) + kahanmacheps(T::Type{<: AbstractFloat}) Calculate the Kahan machine epsilon using the following expression: `3(4/3 - 1) - 1`. # 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) end