scipy.special.round#
- scipy.special.round(x, out=None) = <ufunc 'round'>#
四捨五入到最接近的整數。
傳回最接近 x 的整數。如果 x 正好以 0.5 結尾,則選擇最接近的偶數整數。
- 參數:
- x陣列型 (array_like)
實數值輸入。
- outndarray,選填
函數結果的選填輸出陣列。
- 傳回:
- 純量或 ndarray
x 元素最接近的整數。結果為浮點類型,而非整數類型。
範例
>>> import scipy.special as sc
它會四捨五入到偶數。
>>> sc.round([0.5, 1.5]) array([0., 2.])