Home » Julia

Finding the minimum/smallest value of a data type in Julia

Julia typemin() function example: Here, we are going to learn how to find the minimum/smallest value of a data type in Julia programming language?
Submitted by IncludeHelp, on March 27, 2020

To find the minimum value that a data type can hold, we use the typemin() function – it accepts a data type and returns its minimum value.

Example:

# finding the minimum values of the various
# data types

print("Min value of Int8: ")
println(typemin(Int8))

print("Min value of UInt8: ")
println(typemin(UInt8))

print("Min value of Int16: ")
println(typemin(Int16))

print("Min value of UInt16: ")
println(typemin(UInt16))

print("Min value of Int32: ")
println(typemin(Int32))

print("Min value of UInt32: ")
println(typemin(UInt32))

print("Min value of Int64: ")
println(typemin(Int64))

print("Min value of UInt64: ")
println(typemin(UInt64))

print("Min value of Int128: ")
println(typemin(Int128))

print("Min value of UInt128: ")
println(typemin(UInt128))

print("Min value of Bool: ")
println(typemin(Bool))

Output

Min value of Int8: -128
Min value of UInt8: 0
Min value of Int16: -32768
Min value of UInt16: 0
Min value of Int32: -2147483648
Min value of UInt32: 0
Min value of Int64: -9223372036854775808
Min value of UInt64: 0
Min value of Int128: -170141183460469231731687303715884105728
Min value of UInt128: 0
Min value of Bool: false


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.