- copysign() is a python math function which are able to change the sign of the numeric values.
-Here copysign() takes two argument both are number, it can be positive or negative both.
-It return the float num1 with the sign of num2.
num1 is 4
num2 is -n
copysign(num1,num2) will return -4
num1 is -4
num2 is n
copysign(num1,num2) will return 4
-In this program, we import the math library by import math, then we have a two number 4 and -1 , copysign(4,-1) will return -4.0 because of num2 is negative number.
What if we try to put 0 at num1 and num2.
-It will give no issue and work correctly and copysign(3,0) will return 3.0 that means 0 is also consider on positive number side.