diff --git a/backend.native/tests/stdlib_external/utils.kt b/backend.native/tests/stdlib_external/utils.kt index d6df40db319..4ead55a24fd 100644 --- a/backend.native/tests/stdlib_external/utils.kt +++ b/backend.native/tests/stdlib_external/utils.kt @@ -23,4 +23,7 @@ internal actual inline fun testOnNonJvm6And7(f: () -> Unit) { } actual fun testOnJvm(action: () -> Unit) {} -actual fun testOnJs(action: () -> Unit) {} \ No newline at end of file +actual fun testOnJs(action: () -> Unit) {} + + +public actual val isFloat32RangeEnforced: Boolean get() = true diff --git a/runtime/src/main/kotlin/kotlin/Primitives.kt b/runtime/src/main/kotlin/kotlin/Primitives.kt index 0b29897deee..ae1473f6da0 100644 --- a/runtime/src/main/kotlin/kotlin/Primitives.kt +++ b/runtime/src/main/kotlin/kotlin/Primitives.kt @@ -1158,18 +1158,31 @@ public final class Float private constructor() : Number(), Comparable { * A constant holding the positive infinity value of Float. */ @Suppress("DIVISION_BY_ZERO") - public val POSITIVE_INFINITY: Float = 1.0f / 0.0f + public const val POSITIVE_INFINITY: Float = 1.0f / 0.0f /** * A constant holding the negative infinity value of Float. */ @Suppress("DIVISION_BY_ZERO") - public val NEGATIVE_INFINITY: Float = -1.0f / 0.0f + public const val NEGATIVE_INFINITY: Float = -1.0f / 0.0f /** * A constant holding the "not a number" value of Float. */ - public val NaN: Float = kotlinx.cinterop.bitsToFloat(0x7fc00000) + @Suppress("DIVISION_BY_ZERO") + 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 } /** @@ -1415,18 +1428,31 @@ public final class Double private constructor() : Number(), Comparable { * A constant holding the positive infinity value of Double. */ @Suppress("DIVISION_BY_ZERO") - public val POSITIVE_INFINITY: Double = 1.0 / 0.0 + public const val POSITIVE_INFINITY: Double = 1.0 / 0.0 /** * A constant holding the negative infinity value of Double. */ @Suppress("DIVISION_BY_ZERO") - public val NEGATIVE_INFINITY: Double = -1.0 / 0.0 + public const val NEGATIVE_INFINITY: Double = -1.0 / 0.0 /** * A constant holding the "not a number" value of Double. */ - public val NaN: Double = kotlinx.cinterop.bitsToDouble(0x7ff8000000000000L) + @Suppress("DIVISION_BY_ZERO") + 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 } /**