W3cubDocs

/Kotlin

withSign

Platform and version requirements: JVM (1.2), JS (1.2), Native (1.2)
fun Double.withSign(sign: Double): Double
fun Float.withSign(sign: Float): Float

Returns this value with the sign bit same as of the sign value.

If sign is NaN the sign of the result is undefined.

Platform and version requirements: JVM (1.2), JS (1.2), Native (1.2)
fun Double.withSign(sign: Int): Double
fun Float.withSign(sign: Int): Float

Returns this value with the sign bit same as of the sign value.

© 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/with-sign.html