more type fixes for abstract float

This commit is contained in:
jacekpoz 2024-11-08 10:23:19 +01:00
parent 3a46ee1ea0
commit 929cdd9ef3
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
2 changed files with 6 additions and 6 deletions

View file

@ -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.

View file

@ -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