realmax

realmax(T)

The highest finite value representable by the given floating-point DataType T.

Examples

  1. Get the highest finite value of Float64:

    julia> realmax(Float64)
    1.7976931348623157e308

    This example returns the highest finite value representable by the Float64 data type.

  2. Get the highest finite value of Float32:

    julia> realmax(Float32)
    3.4028235f38

    It returns the highest finite value representable by the Float32 data type.

  3. Use realmax with a user-defined data type:
    julia> struct MyFloat{T} <: AbstractFloat end
    julia> Base.realmax(::Type{<:MyFloat}) = 100.0
    julia> realmax(MyFloat)
    100.0

    This example demonstrates how the realmax function can be extended for a custom user-defined floating-point data type MyFloat.

Common mistake example:

julia> realmax(Float)
ERROR: MethodError: no method matching realmax(::Type{Type{Float64}})

In this example, Float is not a concrete floating-point data type. The realmax function requires a specific floating-point data type as an argument.

See Also

cummax, eigmax, findmax, hist, hist!, hist2d, hist2d!, histrange, indmax, maxabs, maxabs!, maximum!, mean, mean!, median, median!, minabs, minabs!, minimum!, minmax, quantile!, realmax, std, stdm,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: