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: Double(source)
expect val Float.sign: Float(source)

Returns the sign of this value:

  • -1.0 if the value is negative,

  • zero if the value is zero,

  • 1.0 if the value is positive

Special case:

  • NaN.sign is NaN

Since Kotlin

1.2

expect val Int.sign: Int(source)
expect val Long.sign: Int(source)

Returns the sign of this value:

  • -1 if the value is negative,

  • 0 if the value is zero,

  • 1 if the value is positive

Since Kotlin

1.2
actual inline fun sign(x: Double): Double(source)
actual inline 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

actual val Double.sign: Double(source)
actual val Float.sign: Float(source)

Returns the sign of this value:

  • -1.0 if the value is negative,

  • zero if the value is zero,

  • 1.0 if the value is positive

Special case:

  • NaN.sign is NaN

Since Kotlin

1.2

actual val Int.sign: Int(source)
actual val Long.sign: Int(source)

Returns the sign of this value:

  • -1 if the value is negative,

  • 0 if the value is zero,

  • 1 if the value is positive

Since Kotlin

1.2
actual inline fun sign(x: Double): Double(source)
actual inline 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

actual val Double.sign: Double(source)
actual val Float.sign: Float(source)

Returns the sign of this value:

  • -1.0 if the value is negative,

  • zero if the value is zero,

  • 1.0 if the value is positive

Special case:

  • NaN.sign is NaN

Since Kotlin

1.2

actual val Int.sign: Int(source)
actual val Long.sign: Int(source)

Returns the sign of this value:

  • -1 if the value is negative,

  • 0 if the value is zero,

  • 1 if the value is positive

Since Kotlin

1.2
actual fun sign(x: Double): Double(source)
actual 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.3

actual val Double.sign: Double(source)
actual val Float.sign: Float(source)

Returns the sign of this value:

  • -1.0 if the value is negative,

  • zero if the value is zero,

  • 1.0 if the value is positive

Special case:

  • NaN.sign is NaN

Since Kotlin

1.3

actual val Int.sign: Int(source)
actual val Long.sign: Int(source)

Returns the sign of this value:

  • -1 if the value is negative,

  • 0 if the value is zero,

  • 1 if the value is positive

Since Kotlin

1.3
actual fun sign(x: Double): Double(source)
actual 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.8

actual val Double.sign: Double(source)
actual val Float.sign: Float(source)

Returns the sign of this value:

  • -1.0 if the value is negative,

  • zero if the value is zero,

  • 1.0 if the value is positive

Special case:

  • NaN.sign is NaN

Since Kotlin

1.8

actual val Int.sign: Int(source)
actual val Long.sign: Int(source)

Returns the sign of this value:

  • -1 if the value is negative,

  • 0 if the value is zero,

  • 1 if the value is positive

Since Kotlin

1.8
actual fun sign(x: Double): Double(source)
actual 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.8

actual val Double.sign: Double(source)
actual val Float.sign: Float(source)

Returns the sign of this value:

  • -1.0 if the value is negative,

  • zero if the value is zero,

  • 1.0 if the value is positive

Special case:

  • NaN.sign is NaN

Since Kotlin

1.8

actual val Int.sign: Int(source)
actual val Long.sign: Int(source)

Returns the sign of this value:

  • -1 if the value is negative,

  • 0 if the value is zero,

  • 1 if the value is positive

Since Kotlin

1.8