abs

Common
JVM
JS
Native
1.2
fun abs(x: Double): Double
fun abs(x: Float): Float

Returns the absolute value of the given value x.

Special cases:

  • abs(NaN) is NaN

See Also

absoluteValue

Common
JVM
JS
Native
1.2
fun abs(n: Int): Int

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

Common
JVM
JS
Native
1.2
fun abs(n: Long): Long

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