Getting square of absolute value in Julia – abs2() Method
The abs2() is an inbuilt function in julia which is used to return square of the absolute value of the specified number x.
Syntax: abs2(x)
Parameters:
- x: Specified value.
Returns: It returns square of the absolute value of the specified number x.
Example 1:
# Julia program to illustrate # the use of abs2() method # Getting square of absolute value # of the specified number xprintln(abs2(0))println(abs2(2))println(abs2(-5)) |
Output:
0 4 25
Example 2:
# Julia program to illustrate # the use of abs2() method # Getting square of absolute value # of the specified number xprintln(abs2(0))println(abs2(-2.7))println(abs2(-2.9))println(abs2(0.7))println(abs2(-0.2))println(abs2(22)) |
Output:
0 7.290000000000001 8.41 0.48999999999999994 0.04000000000000001 484


