sign
Returns the sign of the given value x:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special cases:
- sign(NaN)is- NaN
- sign(-0.0)is- -0.0
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   println(sign(3.14)) // 1.0
println(sign(-3.14)) // -1.0
println(sign(0.0)) // 0.0
println(sign(Double.POSITIVE_INFINITY)) // 1.0
println(sign(Double.NEGATIVE_INFINITY)) // -1.0
// Special cases
println(sign(Double.NaN)) // NaN
println(sign(-0.0)) // -0.0 
   //sampleEnd
}Returns the sign of the given value x:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special cases:
- sign(NaN)is- NaN
- sign(-0.0)is- -0.0
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   println(sign(3.14f)) // 1.0
println(sign(-3.14f)) // -1.0
println(sign(0.0f)) // 0.0
println(sign(Float.POSITIVE_INFINITY)) // 1.0
println(sign(Float.NEGATIVE_INFINITY)) // -1.0
// Special cases
println(sign(Float.NaN)) // NaN
println(sign(-0.0f)) // -0.0 
   //sampleEnd
}Returns the sign of this value:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special cases:
- NaN.signis- NaN
- (-0.0).signis- -0.0
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   println(3.14.sign) // 1.0
println((-3.14).sign) // -1.0
println(0.0.sign) // 0.0
println(Double.POSITIVE_INFINITY.sign) // 1.0
println(Double.NEGATIVE_INFINITY.sign) // -1.0
// Special cases
println(Double.NaN.sign) // NaN
println((-0.0).sign) // -0.0 
   //sampleEnd
}Returns the sign of this value:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special cases:
- NaN.signis- NaN
- (-0.0).signis- -0.0
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   println(3.14f.sign) // 1.0
println((-3.14f).sign) // -1.0
println(0.0f.sign) // 0.0
println(Float.POSITIVE_INFINITY.sign) // 1.0
println(Float.NEGATIVE_INFINITY.sign) // -1.0
// Special cases
println(Float.NaN.sign) // NaN
println((-0.0f).sign) // -0.0 
   //sampleEnd
}Returns the sign of this value:
- -1if the value is negative,
- 0if the value is zero,
- 1if the value is positive
Since Kotlin
1.2Returns the sign of the given value x:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special case:
- sign(NaN)is- NaN
Since Kotlin
1.2Returns the sign of this value:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special case:
- NaN.signis- NaN
Since Kotlin
1.2Returns the sign of this value:
- -1if the value is negative,
- 0if the value is zero,
- 1if the value is positive
Since Kotlin
1.2Returns the sign of the given value x:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special case:
- sign(NaN)is- NaN
Since Kotlin
1.2Returns the sign of this value:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special case:
- NaN.signis- NaN
Since Kotlin
1.2Returns the sign of this value:
- -1if the value is negative,
- 0if the value is zero,
- 1if the value is positive
Since Kotlin
1.2Returns the sign of the given value x:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special case:
- sign(NaN)is- NaN
Since Kotlin
1.3Returns the sign of this value:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special case:
- NaN.signis- NaN
Since Kotlin
1.3Returns the sign of this value:
- -1if the value is negative,
- 0if the value is zero,
- 1if the value is positive
Since Kotlin
1.3Returns the sign of the given value x:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special case:
- sign(NaN)is- NaN
Since Kotlin
1.8Returns the sign of this value:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special case:
- NaN.signis- NaN
Since Kotlin
1.8Returns the sign of this value:
- -1if the value is negative,
- 0if the value is zero,
- 1if the value is positive
Since Kotlin
1.8Returns the sign of the given value x:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special case:
- sign(NaN)is- NaN
Since Kotlin
1.8Returns the sign of this value:
- -1.0if the value is negative,
- zero if the value is zero, 
- 1.0if the value is positive
Special case:
- NaN.signis- NaN
Since Kotlin
1.8Returns the sign of this value:
- -1if the value is negative,
- 0if the value is zero,
- 1if the value is positive