Add SIZE_BITS and SIZE_BYTES constants to Double and Float

#KT-29182
This commit is contained in:
Ilya Gorbunov
2019-10-08 19:42:42 +03:00
parent 1c93911279
commit f3fc1197ae
6 changed files with 72 additions and 3 deletions
@@ -701,6 +701,18 @@ public class Float private constructor() : Number(), Comparable<Float> {
* A constant holding the "not a number" value of Float.
*/
public const val NaN: Float = -(0.0F/0.0F)
/**
* The number of bytes used to represent an instance of Float in a binary form.
*/
@SinceKotlin("1.4")
public const val SIZE_BYTES: Int = 4
/**
* The number of bits used to represent an instance of Float in a binary form.
*/
@SinceKotlin("1.4")
public const val SIZE_BITS: Int = 32
}
/**
@@ -906,6 +918,18 @@ public class Double private constructor() : Number(), Comparable<Double> {
* A constant holding the "not a number" value of Double.
*/
public const val NaN: Double = -(0.0/0.0)
/**
* The number of bytes used to represent an instance of Double in a binary form.
*/
@SinceKotlin("1.4")
public const val SIZE_BYTES: Int = 8
/**
* The number of bits used to represent an instance of Double in a binary form.
*/
@SinceKotlin("1.4")
public const val SIZE_BITS: Int = 64
}
/**