W3cubDocs

/Kotlin

abs

inline fun abs(x: Double): Double

Platform and version requirements: Kotlin 1.2

inline fun abs(x: Float): Float

Platform and version requirements: Kotlin 1.2

Returns the absolute value of the given value x.

Special cases:

  • abs(NaN) is NaN

See Also

absoluteValue

inline fun abs(n: Int): Int

Platform and version requirements: Kotlin 1.2

Returns the absolute value of the given value n.

Special cases:

  • abs(Int.MIN_VALUE) is Int.MIN_VALUE due to an overflow

See Also

absoluteValue

inline fun abs(n: Long): Long

Platform and version requirements: Kotlin 1.2

Returns the absolute value of the given value n.

Special cases:

  • abs(Long.MIN_VALUE) is Long.MIN_VALUE due to an overflow

See Also

absoluteValue

© 2010–2018 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.math/abs.html