signbit
Syntax
signbit(X)
Details
Detects the sign bit of the input value.
Note:
DolphinDB signbit provides the same core functionality as numpy.signbit.The differences are as
follows:
- DolphinDB
signbitis primarily intended for floating-point or integer scalars. For complex numbers, you can uselowDoubleandhighDoubleto check the real and imaginary parts separately. numpy.signbitsupports element-wise computation on both scalars and arrays, and also supports additional parameters such as out, where。
Parameters
X is a floating-point or integer scalar.
Returns
true if X is negative, false otherwise.
Examples
$ signbit('a')
false
$ signbit(-21)
true
$ signbit(-2.1)
true
$ b=complex(10,-5)// create a complex number
$ b
10.0-5.0i
$ signbit(highDouble(b)) // detect the sign bit of the imaginary number
true
$ signbit(lowDouble(b)) // detect the sign bit of the real number
false
