From 3a46ee1ea09b92306bde70da348531e562116fe2 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Fri, 8 Nov 2024 10:21:34 +0100 Subject: [PATCH] finally, Type{<: AbstractFloat} --- l1/1.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/l1/1.jl b/l1/1.jl index 69b15d8..0c53aa9 100755 --- a/l1/1.jl +++ b/l1/1.jl @@ -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))