Math Functions
math.copysign()
Combine the magnitude of the first value with the sign of the second, including signed zero.
Formal Syntax & Structure
python syntaxpython
math.copysign(x, y, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | real number | Input real value. |
| y | real number | Second real value. |
Return Value
float
Floating-point result; finite precision and domain restrictions apply.
Working Example
Example Snippetpython
import mathprint(math.copysign(8, -0.0))