title: How to make a compile time constant NaN or POSITIVE_INFINITY in Kotlin?
body: <p>I tried:</p>
  
  <pre><code>import kotlin.Double.Companion.POSITIVE_INFINITY
  import kotlin.Double.Companion.NaN
  
  const val inf = POSITIVE_INFINITY
  const val nan = NaN
  </code></pre>
  
  <p>But I get:</p>
  
  <blockquote>
    <p>Const 'val' initializer should be a constant value</p>
  </blockquote>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>The reason I need to do this is because of <a href="https://blog.codefx.org/libraries/junit-5-parameterized-tests/#Value-Source" rel="nofollow noreferrer">Junit5's parametrized tests</a>:</p>
  
  <pre><code> @ParameterizedTest
   @ValueSource(doubles = doubleArrayOf(nan, inf, -2* epsilon,  1.5, -0.5, 1.0 + 2* epsilon))
   fun ensureNotAProbability(number: Double)
   {
       ...
   }  
  </code></pre>
  
  <p>Due to some limitations of Java annotations (described in <a href="https://stackoverflow.com/a/2067863/1097451">this SO answer</a>) the things 'passed to an annotation' can only be compile-time constants. Therefore I would need a compile time NaN, positive, and negative infinities.</p>