On Wed, 22 Feb 2023 09:46:59 GMT, Doug Simon <dnsi...@openjdk.org> wrote:

> > That said, I think it is reasonable on a given JVM invocation if 
> > Float.floatToFloat16(f) gave the same result for input f regardless of in 
> > what context it was called.
> 
> Yes, I'm under the impression that for math API methods like this, the 
> stability of input to output must be preserved for a single JVM invocation. 
> Or are there existing methods for which the interpreter and compiled code 
> execution is allowed to differ?

A similar but not exactly analagous situation occurs for the intrinsics of 
various java.lang.Math methods. Many of the methods of interest allow 
implementation flexibility, subject to various quality of implementation 
criteria. Those criteria bound the maximum error at a single point, phrased in 
terms of ulps -- units in the last place, and require semi-monotonicity -- 
which describes the relation of outputs of adjacent floating-point values.

Taking two compliant implementations of Math.foo(), it is not necessarily a 
valid implementation to switch between them because the semi-monotonicity 
constraint can be violated. The solution is to always use or always not use an 
intrinsic for Math.foo on a given JVM invocation. HTH

-------------

PR: https://git.openjdk.org/jdk/pull/12704

Reply via email to