Observability of NaN distinctions — is this a concern?

Brendan Eich brendan at mozilla.com
Mon Mar 25 14:40:42 PDT 2013


Kenneth Russell wrote:
>> >  For interop, JS requires cross-browser (VM) NaN canonicalization to avoid
>> >  observably different results on different browsers.
>
> As long as NaN values loaded from Float32Array and Float64Array obey
> ES6's semantics, such as returning true from isNaN(), then it should
> not matter whether the ES6 implementation happens to support multiple
> bit patterns for NaN.

That's at issue. By reading via an aliasing byte or wider integral-typed 
array view, different results could be observed on two VMs for the exact 
same code.

> NaNs are an error condition and corner case in
> floating-point algorithms, and it is important not to negatively
> impact the performance of the common case in order to achieve
> absolutely precise semantics for this error case.

I want "as close to the metal as safety and interop allow" performance. 
I'm not sure we are actually in conflict here, given how aggressive JITs 
work.

Have you measured the performance impact in any optimizing VM?

/be



More information about the es-discuss mailing list