Python | math.copysign() function Last Updated : 11 Mar, 2019 Comments Improve Suggest changes Like Article Like Report In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.copysign(a, b) function return a float with the magnitude (absolute value) of a but the sign of b. Syntax: math.copysign(a, b) Parameter: a, b: numeric values. Returns: Return absolute value of a but the sign of b. Code #1: Python3 1== # Python code to demonstrate the working of copysign() # importing "math" for mathematical operations import math a = 5.2 b = -25 # returning the copysign print ("The copysign of 5.2 and -25 is : ", end ="") print (math.copysign(a, b)) Output: The copysign of 5.2 and -25 is : -5.2 Code #2: Python3 1== # Python code to demonstrate the working of factorial() # importing "math" for mathematical operations import math # returning the copysign print (math.copysign(-13, 25.5)) print (math.copysign(2.87, -15)) Output: 13.0 -2.87 Comment More infoAdvertise with us Next Article Python | math.copysign() function S Shivam_k Follow Improve Article Tags : Python Python math-library-functions Practice Tags : python Similar Reads Python math function | copysign() math.copysign() is a function exists in Standard math Library of Python. This function returns a float value consisting of magnitude from parameter x and the sign (+ve or -ve) from parameter y. Syntax : math.copysign(x, y) Parameters : x : Integer value to be converted y : Integer whose sign is requ 1 min read numpy.copysign() in Python numpy.copysign(arr1, arr2, out = None, where = True, casting = âsame_kindâ, order = âKâ, dtype = None) : This mathematical function helps user to change the sign of arr1 and arr2. Both arr1 or arr2 can be either list/sequence or a scalar value. If sequence, both must have same dimension; otherwise a 2 min read Python complex() Function Python provides a built-in function called complex() to handle complex numbers. A complex number consists of a real part and an imaginary part, represented in the form: a + bjWhere,a is the real partb is the imaginary partj is the imaginary unit, which is equal to the square root of -1python uses 'j 2 min read Python - math.ulp(x) function ULP stands for âUnit in the Last Placeâ. math.ulp() is introduced in python 3.9.0 version, it returns the value of the least significant bit of the float x. In numerical analysis and computer science, unit of least precision (ULP) or unit in the last place is the spacing between floating-point numbe 2 min read modf() function - Python modf() function is an inbuilt function in Python that returns the fractional and integer parts of the number in a two-item tuple. Both parts have the same sign as the number. The integer part is returned as a float. Example:Pythonimport math # modf() function used with a positive number print("math. 3 min read Like