fun sign(x: Double): Double
fun sign(x: Float): Float
Returns the sign of the given value x:
-1.0 if the value is negative,1.0 if the value is positiveSpecial case:
sign(NaN) is NaN
val Double.sign: Double
inline val Double.sign: Double
val Float.sign: Float
inline val Float.sign: Float
Returns the sign of this value:
-1.0 if the value is negative,1.0 if the value is positiveSpecial case:
NaN.sign is NaN
val Int.sign: Int
val Long.sign: Int
Returns the sign of this value:
-1 if the value is negative,0 if the value is zero,1 if the value is positive
© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.math/sign.html