Home »
Julia
signbit() Function with Example in Julia
Julia | signbit() function: In this tutorial, we are going to learn about the signbit() function with example in the Julia programming language.
Submitted by IncludeHelp, on April 04, 2020
Julia | signbit() function
signbit() function is a library function in Julia programming language, it is used to check whether sign bit of number is ON or OFF, it returns true if the number is negative, otherwise, false.
Syntax:
signbit(val)
Parameter(s):
- val – represents a signed integer/value, whose sign bit to be checked.
Return value:
The return type of this method is Bool, it returns true if the number is negative, otherwise, false.
Example:
Input:
val = 0
Output:
signbit(val): false
Input:
val = -10
Output:
signbit(val): true
Input:
val = 10
signbit(val): false
Program:
# signbit() Function with Example in Julia
val = 0
println("val: ", val)
println("signbit(val): ", signbit(val))
val = 10
println("val: ", val)
println("signbit(val): ", signbit(val))
val = -10
println("val: ", val)
println("signbit(val): ", signbit(val))
val = 10.23
println("val: ", val)
println("signbit(val): ", signbit(val))
val = -10.23
println("val: ", val)
println("signbit(val): ", signbit(val))
# printing the return type of signbit()
println("typeof(signbit(-10)): ", typeof(signbit(-10)))
Output
val: 0
signbit(val): false
val: 10
signbit(val): false
val: -10
signbit(val): true
val: 10.23
signbit(val): false
val: -10.23
signbit(val): true
typeof(signbit(-10)): Bool