파이썬 math.copysign() 메서드
예시
첫 번째 매개변수의 값과 두 번째 매개변수의 부호를 반환합니다.
#Import math Library
import math
#Return the value of the first
parameter and the sign of the second parameter
print(math.copysign(4, -1))
print(math.copysign(-8, 97.21))
print(math.copysign(-43, -76))
정의 및 사용
이 math.copysign()
메서드는 첫 번째 매개변수의 값과 두 번째 매개변수의 부호(+/-)로 구성된 부동 소수점을 반환합니다.
통사론
math.copysign(x, y)
매개변수 값
Parameter | Description |
---|---|
x | Required. A number. The return will have the value of this parameter |
y | Required. A number. The return will have the sign (+/-) of this parameter |
기술적 세부 사항
반환 값: | 첫 번째 매개변수 의 float 값과 두 번째 매개변수의 부호로 구성된 값 |
---|---|
파이썬 버전: | 2.6 |