Open In App

Getting lowest and highest value of a Data type in Julia – typemin() and typemax() Methods

The typemin() is an inbuilt function in julia which is used to return the lowest value representable by the specified numeric DataType.

Syntax: typemin(T)



Parameters:

  • T: Specified numeric DataType.

Returns: It returns the lowest value representable by the specified numeric DataType.



Example 1:




# Julia program to illustrate 
# the use of typemin() method
  
# Getting the lowest value representable 
# by the specified numeric DataType.
println(typemin(Float16))
println(typemin(Float32))
println(typemin(Float64))
println(typemin(Int32))
println(typemin(Int64))

Output:

typemax()

The typemax() is an inbuilt function in julia which is used to return the highest value representable by the specified numeric DataType.

Syntax: typemax(T)

Parameters:

  • T: Specified numeric DataType.

Returns: It returns the value highest representable by the specified numeric DataType.

Example 1:




# Julia program to illustrate 
# the use of typemax() method
  
# Getting the highest value representable 
# by the specified numeric DataType.
println(typemax(Float16))
println(typemax(Float32))
println(typemax(Float64))
println(typemax(Int32))
println(typemax(UInt32))
println(typemax(Int64))

Output:

Article Tags :