Built-in Functions¶
Built-in Functions | ||
---|---|---|
abs() | min() | max() |
len() | round() | ceil() |
floor() | sqrt() | ldexp() |
abs(x)¶
Return the absolute value of a number. The argument may be an scalar or a vector. In vector form absolute value of each element is calculated.
res1 = abs(float64(-6.3)) # res1 = 6.3
res2 = abs(int32x4(-3, 4, -7, 1)) # res2 = 3, 4, 7, 1
res3 = abs(float32x4(-4, 3, 5, -8)) # res3 = 4, 3, 5, 8
Supported argument data types: int32
, int64
, float32
, float64
, int32x2
, int32x3
,
int32x4
, int32x8
, int32x16
, int64x2
, int64x3
,
int64x4
, int64x8
, float32x2
, float32x3
, float32x4
, float32x8
, float32x16
, float64x2
,
float64x3
, float64x4
, float64x8
.
round(x)¶
The value of x rounded to the nearest integer (as a float value).
res = round(float64x2(0.7, 2.8)) # res = 1.0, 3.0
ceil(x)¶
Rounds x upward, returning the smallest integral value that is not less than x (as a float value).
res = ceil(float64x2(0.3, 2.8)) # res = 1.0, 3.0
floor(x)¶
Rounds x downward, returning the largest integral value that is not greater than x (as a float value).
res = floor(float64x2(0.3, 2.8)) # res = 0.0, 2.0