sign

expect fun sign(x: Double): Double(source)
expect fun sign(x: Float): Float(source)

Returns the sign of the given value x:

  • -1.0 if the value is negative,

  • zero if the value is zero,

  • 1.0 if the value is positive

Special case:

  • sign(NaN) is NaN

Since Kotlin

1.2

expect val Double.sign: