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

Represents a double-precision 64-bit IEEE 754 floating point number.

Since Kotlin

1.3

Types

Link copied to clipboard
object Companion
Since Kotlin 1.0
object Companion
Since Kotlin 1.3

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

Returns the absolute value of this value.

Since Kotlin 1.3
Link copied to clipboard

Returns a Duration equal to this Double number of days.

Since Kotlin 1.3

Returns a Duration equal to this Double number of days.

Since Kotlin 1.6
Link copied to clipboard

Returns a Duration equal to this Double number of hours.

Since Kotlin 1.3

Returns a Duration equal to this Double number of hours.

Since Kotlin 1.6
Link copied to clipboard

Returns a Duration equal to this Double number of microseconds.

Since Kotlin 1.3

Returns a Duration equal to this Double number of microseconds.

Since Kotlin 1.6
Link copied to clipboard

Returns a Duration equal to this Double number of milliseconds.

Since Kotlin 1.3

Returns a Duration equal to this Double number of milliseconds.

Since Kotlin 1.6
Link copied to clipboard

Returns a Duration equal to this Double number of minutes.

Since Kotlin 1.3

Returns a Duration equal to this Double number of minutes.

Since Kotlin 1.6
Link copied to clipboard

Returns a Duration equal to this Double number of nanoseconds.

Since Kotlin 1.3

Returns a Duration equal to this Double number of nanoseconds.

Since Kotlin 1.6
Link copied to clipboard

Returns a Duration equal to this Double number of seconds.

Since Kotlin 1.3

Returns a Duration equal to this Double number of seconds.

Since Kotlin 1.6
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
actual val Double.sign: Double

Returns the sign of this value:

Since Kotlin 1.3
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
actual val Double.ulp: Double

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

Since Kotlin 1.3

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
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.3
Link copied to clipboard
infix inline fun <T> Comparable<T>.compareTo(other: T): Int

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

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

Returns this value decremented by one.

Since Kotlin 1.0
operator external fun dec(): Double

Returns this value decremented by one.

Since Kotlin 1.3
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
inline operator fun div(other: Byte): Double
operator external fun div(other: Double): Double
inline operator fun div(other: Float): Double
inline operator fun div(other: Int): Double
inline operator fun div(other: Long): Double
inline operator fun div(other: Short): Double

Divides this value by the other value.

Since Kotlin 1.3
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Since Kotlin 1.0
open operator override fun equals(other: Any?): Boolean
fun equals(other: Double): Boolean
Since Kotlin 1.3
Link copied to clipboard
open override fun hashCode(): Int
Since Kotlin 1.3
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
external 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.3
Link copied to clipboard
operator fun inc(): Double

Returns this value incremented by one.

Since Kotlin 1.0
operator external fun inc(): Double

Returns this value incremented by one.

Since Kotlin 1.3
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
actual external 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.3
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
actual external fun Double.isInfinite(): Boolean

Returns true if this value is infinitely large in magnitude.

Since Kotlin 1.3
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
actual external fun Double.isNaN(): Boolean

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

Since Kotlin 1.3
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
inline operator fun minus(other: Byte): Double
operator external fun minus(other: Double): Double
inline operator fun minus(other: Float): Double
inline operator fun minus(other: Int): Double
inline operator fun minus(other: Long): Double
inline operator fun minus(other: Short): Double

Subtracts the other value from this value.

Since Kotlin 1.3
Link copied to clipboard
inline fun Double.mod(other: Double): Double
inline fun Double.mod(other: Float): Double

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

Since Kotlin 1.5
Link copied to clipboard
inline external fun <R : Number> Number.narrow(): R
Since Kotlin 1.3
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
actual external fun Double.nextDown(): Double

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

Since Kotlin 1.3
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
actual external 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.3
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
actual external fun Double.nextUp(): Double

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

Since Kotlin 1.3
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
inline operator fun plus(other: Byte): Double
operator external fun plus(other: Double): Double
inline operator fun plus(other: Float): Double
inline operator fun plus(other: Int): Double
inline operator fun plus(other: Long): Double
inline operator fun plus(other: Short): Double

Adds the other value to this value.

Since Kotlin 1.3
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
actual external fun Double.pow(x: Double): Double

Raises this value to the power x.

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

Raises this value to the integer power n.

Since Kotlin 1.3
Link copied to clipboard

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

Since Kotlin 1.1
Link copied to clipboard

Creates an open-ended range from this Double value to the specified that value.

Since Kotlin 1.7
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
inline operator fun rem(other: Byte): Double
operator external fun rem(other: Double): Double
inline operator fun rem(other: Float): Double
inline operator fun rem(other: Int): Double
inline operator fun rem(other: Long): Double
inline operator fun rem(other: Short): Double

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

Since Kotlin 1.3
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
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.3
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
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.3
Link copied to clipboard
inline external fun <R : Number> Number.signExtend(): R
Since Kotlin 1.3
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
inline operator fun times(other: Byte): Double
operator external fun times(other: Double): Double
inline operator fun times(other: Float): Double
inline operator fun times(other: Int): Double
inline operator fun times(other: Long): Double
inline operator fun times(other: Short): Double

Multiplies this value by the other value.

Since Kotlin 1.3
Link copied to clipboard
inline operator fun Double.times(duration: Duration): Duration

Returns a duration whose value is the specified duration value multiplied by this number.

Since Kotlin 1.6
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
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.3
Link copied to clipboard
open override fun toByte(): Byte

Converts this Double value to Byte.

Since Kotlin 1.0
open override fun toByte(): Byte

Converts this Double value to Byte.

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

Converts this Double value to Char.

Since Kotlin 1.0
open override fun toChar(): Char

Converts this Double value to Char.

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

Returns this value.

Since Kotlin 1.0
open inline override fun toDouble(): Double

Returns this value.

Since Kotlin 1.3
Link copied to clipboard

Returns a Duration equal to this Double number of the specified unit.

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

Converts this Double value to Float.

Since Kotlin 1.0
open external override fun toFloat(): Float

Converts this Double value to Float.

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

Converts this Double value to Int.

Since Kotlin 1.0
open external override fun toInt(): Int

Converts this Double value to Int.

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

Converts this Double value to Long.

Since Kotlin 1.0
open external override fun toLong(): Long

Converts this Double value to Long.

Since Kotlin 1.3
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
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.3
Link copied to clipboard
open override fun toShort(): Short

Converts this Double value to Short.

Since Kotlin 1.0
open override fun toShort(): Short

Converts this Double value to Short.

Since Kotlin 1.3
Link copied to clipboard
open override fun toString(): String
Since Kotlin 1.0
open override fun toString(): String
Since Kotlin 1.3
Link copied to clipboard
inline fun Double.toUInt(): UInt

Converts this Double value to UInt.

Since Kotlin 1.5
Link copied to clipboard
inline fun Double.toULong(): ULong

Converts this Double value to ULong.

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

Returns the negative of this value.

Since Kotlin 1.0
operator external fun unaryMinus(): Double

Returns the negative of this value.

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

Returns this value.

Since Kotlin 1.0
operator external fun unaryPlus(): Double

Returns this value.

Since Kotlin 1.3
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
actual external fun Double.withSign(sign: Double): Double
actual fun Double.withSign(sign: Int): Double

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

Since Kotlin 1.3