Double

Represents a double-precision 64-bit IEEE 754 floating point number. On the JVM, non-nullable values of this type are represented as values of the primitive type double.

Since Kotlin

1.0

Types

Link copied to clipboard
object Companion
Since Kotlin 1.0

Properties

Link copied to clipboard

Returns the absolute value of this value.

Since Kotlin 1.2

Returns the absolute value of this value.

Since Kotlin 1.2

Returns the absolute value of this value.

Since Kotlin 1.2
Link copied to clipboard
expect val Double.sign: Double

Returns the sign of this value:

Since Kotlin 1.2
actual val Double.sign: Double

Returns the sign of this value:

Since Kotlin 1.2
actual val Double.sign: Double

Returns the sign of this value:

Since Kotlin 1.2
Link copied to clipboard
expect val Double.ulp: Double

Returns the ulp (unit in the last place) of this value.

Since Kotlin 1.2
actual val Double.ulp: Double

Returns the ulp (unit in the last place) of this value.

Since Kotlin 1.2
actual val Double.ulp: Double

Returns the ulp (unit in the last place) of this value.

Since Kotlin 1.2

Functions

Link copied to clipboard
fun Double.coerceAtLeast(minimumValue: Double): Double

Ensures that this value is not less than the specified minimumValue.

Since Kotlin 1.0
Link copied to clipboard
fun Double.coerceAtMost(maximumValue: Double): Double

Ensures that this value is not greater than the specified maximumValue.

Since Kotlin 1.0
Link copied to clipboard
fun Double.coerceIn(minimumValue: Double, maximumValue: Double): Double

Ensures that this value lies in the specified range minimumValue..maximumValue.

Since Kotlin 1.0
Link copied to clipboard
operator fun compareTo(other: Byte): Int
open operator override fun compareTo(other: Double): Int
operator fun compareTo(other: Float): Int
operator fun compareTo(other: Int): Int
operator fun compareTo(other: Long): Int
operator fun compareTo(other: Short): Int

Compares this value with the specified value for order. Returns zero if this value is equal to the specified other value, a negative number if it's less than other, or a positive number if it's greater than other.

Since Kotlin 1.0
Link copied to clipboard
operator fun dec(): Double

Returns this value decremented by one.

Since Kotlin 1.0
Link copied to clipboard
operator fun div(other: Byte): Double
operator fun div(other: Double): Double
operator fun div(other: Float): Double
operator fun div(other: Int): Double
operator fun div(other: Long): Double
operator fun div(other: Short): Double

Divides this value by the other value.

Since Kotlin 1.0
Link copied to clipboard
inline fun Double.IEEErem(divisor: Double): Double

Computes the remainder of division of this value by the divisor value according to the IEEE 754 standard.

Since Kotlin 1.2
Link copied to clipboard
operator fun inc(): Double

Returns this value incremented by one.

Since Kotlin 1.0
Link copied to clipboard
expect fun Double.isFinite(): Boolean
Since Kotlin 1.0
actual fun Double.isFinite(): Boolean

Returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).

Since Kotlin 1.1
actual inline fun Double.isFinite(): Boolean

Returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).

Since Kotlin 1.0
Link copied to clipboard
expect fun Double.isInfinite(): Boolean
Since Kotlin 1.0
actual fun Double.isInfinite(): Boolean

Returns true if this value is infinitely large in magnitude.

Since Kotlin 1.1
actual inline fun Double.isInfinite(): Boolean

Returns true if this value is infinitely large in magnitude.

Since Kotlin 1.0
Link copied to clipboard
expect fun Double.isNaN(): Boolean
Since Kotlin 1.0
actual fun Double.isNaN(): Boolean

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Since Kotlin 1.1
actual inline fun Double.isNaN(): Boolean

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Since Kotlin 1.0
Link copied to clipboard
operator fun minus(other: Byte): Double
operator fun minus(other: Double): Double
operator fun minus(other: Float): Double
operator fun minus(other: Int): Double
operator fun minus(other: Long): Double
operator fun minus(other: Short): Double

Subtracts the other value from this value.

Since Kotlin 1.0
Link copied to clipboard
expect fun Double.nextDown(): Double

Returns the Double value nearest to this value in direction of negative infinity.

Since Kotlin 1.2
actual fun Double.nextDown(): Double

Returns the Double value nearest to this value in direction of negative infinity.

Since Kotlin 1.2
actual inline fun Double.nextDown(): Double

Returns the Double value nearest to this value in direction of negative infinity.

Since Kotlin 1.2
Link copied to clipboard
expect fun Double.nextTowards(to: Double): Double

Returns the Double value nearest to this value in direction from this value towards the value to.

Since Kotlin 1.2
actual fun Double.nextTowards(to: Double): Double

Returns the Double value nearest to this value in direction from this value towards the value to.

Since Kotlin 1.2
actual inline fun Double.nextTowards(to: Double): Double

Returns the Double value nearest to this value in direction from this value towards the value to.

Since Kotlin 1.2
Link copied to clipboard
expect fun Double.nextUp(): Double

Returns the Double value nearest to this value in direction of positive infinity.

Since Kotlin 1.2
actual fun Double.nextUp(): Double

Returns the Double value nearest to this value in direction of positive infinity.

Since Kotlin 1.2
actual inline fun Double.nextUp(): Double

Returns the Double value nearest to this value in direction of positive infinity.

Since Kotlin 1.2
Link copied to clipboard
operator fun plus(other: Byte): Double
operator fun plus(other: Double): Double
operator fun plus(other: Float): Double
operator fun plus(other: Int): Double
operator fun plus(other: Long): Double
operator fun plus(other: Short): Double

Adds the other value to this value.

Since Kotlin 1.0
Link copied to clipboard
expect fun Double.pow(x: Double): Double

Raises this value to the power x.

Since Kotlin 1.2
expect fun Double.pow(n: Int): Double

Raises this value to the integer power n.

Since Kotlin 1.2
actual inline fun Double.pow(x: Double): Double

Raises this value to the power x.

Since Kotlin 1.2
actual inline fun Double.pow(n: Int): Double

Raises this value to the integer power n.

Since Kotlin 1.2
actual inline fun Double.pow(x: Double): Double

Raises this value to the power x.

Since Kotlin 1.2
actual inline fun Double.pow(n: Int): Double

Raises this value to the integer power n.

Since Kotlin 1.2
Link copied to clipboard

Creates a range from this Double value to the specified that value.

Since Kotlin 1.1
Link copied to clipboard
operator fun rem(other: Byte): Double
operator fun rem(other: Double): Double
operator fun rem(other: Float): Double
operator fun rem(other: Int): Double
operator fun rem(other: Long): Double
operator fun rem(other: Short): Double

Calculates the remainder of truncating division of this value by the other value.

Since Kotlin 1.1
Link copied to clipboard
expect fun Double.roundToInt(): Int

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Since Kotlin 1.2
actual fun Double.roundToInt(): Int

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Since Kotlin 1.2
actual fun Double.roundToInt(): Int

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Since Kotlin 1.2
Link copied to clipboard
expect fun Double.roundToLong(): Long

Rounds this Double value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

Since Kotlin 1.2
actual fun Double.roundToLong(): Long

Rounds this Double value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

Since Kotlin 1.2
actual fun Double.roundToLong(): Long

Rounds this Double value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

Since Kotlin 1.2
Link copied to clipboard
operator fun times(other: Byte): Double
operator fun times(other: Double): Double
operator fun times(other: Float): Double
operator fun times(other: Int): Double
operator fun times(other: Long): Double
operator fun times(other: Short): Double

Multiplies this value by the other value.

Since Kotlin 1.0
Link copied to clipboard
inline fun Double.toBigDecimal(mathContext: MathContext): BigDecimal

Returns the value of this Double number as a BigDecimal.

Since Kotlin 1.2
Link copied to clipboard
expect fun Double.toBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout.

Since Kotlin 1.2
actual fun Double.toBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout.

Since Kotlin 1.2
actual inline fun Double.toBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout.

Since Kotlin 1.2
Link copied to clipboard
open override fun toByte(): Byte

Converts this Double value to Byte.

Since Kotlin 1.0
Link copied to clipboard
open override fun toChar(): Char

Converts this Double value to Char.

Since Kotlin 1.0
Link copied to clipboard
open override fun toDouble(): Double

Returns this value.

Since Kotlin 1.0
Link copied to clipboard
open override fun toFloat(): Float

Converts this Double value to Float.

Since Kotlin 1.0
Link copied to clipboard
open override fun toInt(): Int

Converts this Double value to Int.

Since Kotlin 1.0
Link copied to clipboard
open override fun toLong(): Long

Converts this Double value to Long.

Since Kotlin 1.0
Link copied to clipboard
expect fun Double.toRawBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout, preserving NaN values exact layout.

Since Kotlin 1.2
actual fun Double.toRawBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout, preserving NaN values exact layout.

Since Kotlin 1.2
actual inline fun Double.toRawBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout, preserving NaN values exact layout.

Since Kotlin 1.2
Link copied to clipboard
open override fun toShort(): Short

Converts this Double value to Short.

Since Kotlin 1.0
Link copied to clipboard
operator fun unaryMinus(): Double

Returns the negative of this value.

Since Kotlin 1.0
Link copied to clipboard
operator fun unaryPlus(): Double

Returns this value.

Since Kotlin 1.0
Link copied to clipboard
expect fun Double.withSign(sign: Double): Double
expect fun Double.withSign(sign: Int): Double

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

Since Kotlin 1.2
actual fun Double.withSign(sign: Double): Double
actual inline fun Double.withSign(sign: Int): Double

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

Since Kotlin 1.2
actual inline fun Double.withSign(sign: Double): Double
actual inline fun Double.withSign(sign: Int): Double

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

Since Kotlin 1.2