정밀도
출력에 대한 데이터 타입을 지정할 수 있는 예시를 살펴보겠습니다.
import numpy as np
inp = [22, 2, 17, 11, 34]
print("The input array is : ")
print(inp)
## calculate standard deviation
print("The standard deviation of the Input Array is: ")
print(np.std(inp))
## get more precision with float 32
print("\nTo get More precision with float32")
print("Thus std of array is : ", np.std(inp, dtype=np.float32))
## get more accuracy with float 64
print("\nTo get More accuracy with float64")
print("The std of array is : ", np.std(inp, dtype=np.float64))
출력:
The input array is:
[22, 2, 17, 11, 34]
The standard deviation of the Input Array is:
10.721940122944167
To get More precision with float32
Thus std of array is : 10.72194
To get More accuracy with float64
The std of array is: 10.721940122944167
참고: 표준 편차를 더 정확하게 계산하기 위해 dtype float64가 사용됩니다.