Is NaN an uninitialized static val?

public class Float private constructor() : Number(),
Comparable {
companion object {
/**
* A constant holding the smallest positive nonzero value of Float.
*/
public val MIN_VALUE: Float

    /**
     * A constant holding the largest positive finite value of Float.
     */
    public val MAX_VALUE: Float

    /**
     * A constant holding the positive infinity value of Float.
     */
    public val POSITIVE_INFINITY: Float

    /**
     * A constant holding the negative infinity value of Float.
     */
    public val NEGATIVE_INFINITY: Float

    /**
     * A constant holding the "not a number" value of Float.
     */
    public val NaN: Float
}

Hello, @lhmzhou! If I correctly understood your question, the short answer is no. As can be found here, NaN is being initialised.

Awesome, thanks for the confirmation!

Those are just for Kotlin native though. Iā€™m guessing that the values for JVM/JS are supplied by the target VMs as those classes are just the kotlin representations of primitive types.

1 Like