# Distance

A quantity describing a distance. (For example, 10 kilometers.)

Important: This is a Public Preview API. It may be changed or removed at any time.

## Types

object Companion

The unit of a distance's value.

## Functions

open override fun abs(): Distance

Returns a new instance with the value from `this` as absolute value.

open operator override fun compareTo(other: Distance): Int
operator fun div(divisor: Distance): Double

open operator override fun div(divisor: Double): Distance
open operator override fun div(divisor: Int): Distance

Returns a new instance with the value from `this` divided by divisor.

Expresses the distance's value in centimeters.

fun inFeet(): Double

Expresses the distance's value in feet.

Expresses the distance's value in inches.

Expresses the distance's value in kilometers.

Expresses the distance's value in meters.

Expresses the distance's value in miles.

Expresses the distance's value in millimeters.

Expresses the distance's value in centimeters.

Expresses the distance's value in feet.

Expresses the distance's value in inches.

Expresses the distance's value in kilometers.

Expresses the distance's value in meters.

Expresses the distance's value in miles.

Expresses the distance's value in millimeters.

Expresses the distance's value in yards.

Expresses the distance's value in yards.

open operator override fun minus(other: Distance): Distance

Returns a new instance that has other's value subtracted from `this`.

open operator override fun plus(other: Distance): Distance

Returns a new instance with a value equal to the sum of values from `this` and other.

operator fun times(factor: Distance): Double

open operator override fun times(factor: Double): Distance
open operator override fun times(factor: Int): Distance

Returns a new instance with the value from `this` multiplied by factor.

open override fun toDouble(unit: Distance.Unit): Double

Expresses the value of `this` under the given unit as a Double.

open override fun toLong(unit: Distance.Unit): Long

Expresses the value of `this` under the given unit as a Long.

open override fun toString(unit: Distance.Unit, decimals: Int, suffixMode: Quantity.SuffixMode, decimalsMode: Quantity.DecimalsMode): String

Returns a string representation for the value from `this` with the given unit. Depending on decimalsMode, it will show either exactly or at most decimals amount of decimals after the separator. The unit will be suffixed depending on suffixMode.

Returns a new instance with the value from `this` as negative.