W3cubDocs

/Kotlin

absoluteValue

Platform and version requirements: Native (1.2)
val Double.absoluteValue: Double
Platform and version requirements: JVM (1.2), JS (1.2)
inline val Double.absoluteValue: Double
Platform and version requirements: Native (1.2)
val Float.absoluteValue: Float
Platform and version requirements: JVM (1.2), JS (1.2)
inline val Float.absoluteValue: Float

Returns the absolute value of this value.

Special cases:

  • NaN.absoluteValue is NaN

See Also

abs

Platform and version requirements: Native (1.2)
val Int.absoluteValue: Int
Platform and version requirements: JVM (1.2), JS (1.2)
inline val Int.absoluteValue: Int

Returns the absolute value of this value.

Special cases:

  • Int.MIN_VALUE.absoluteValue is Int.MIN_VALUE due to an overflow

See Also

abs

Platform and version requirements: Native (1.2)
val Long.absoluteValue: Long
Platform and version requirements: JVM (1.2), JS (1.2)
inline val Long.absoluteValue: Long

Returns the absolute value of this value.

Special cases:

  • Long.MIN_VALUE.absoluteValue is Long.MIN_VALUE due to an overflow

See Also

abs

© 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/absolute-value.html