@@ -301,3 +301,35 @@ tradeoffs.
301
301
* ` float32.pow ` : exponentiate
302
302
303
303
The rounding behavior of these operations would need clarification.
304
+
305
+ ## Full IEEE-754 conformance
306
+
307
+ WebAssembly floating point conforms IEEE-754 in most respects, but there are a
308
+ few areas that are [ not yet covered] ( AstSemantics.md#floating-point-operations ) .
309
+
310
+ IEEE-754 NaN bit pattern propagation is presently permitted but not required.
311
+ It would be possible for WebAssembly to require it in the future.
312
+
313
+ To support exceptions and alternate rounding modes, one option is to define an
314
+ alternate form for each of ` add ` , ` sub ` , ` mul ` , ` div ` , ` sqrt ` , and ` fma ` . These
315
+ alternate forms would have extra operands for rounding mode, masked traps, and
316
+ old flags, and an extra result for a new flags value. These operations would be
317
+ fairly verbose, but it's expected that their use cases will specialized. This
318
+ approach has the advantage of exposing no global (even if only per-thread)
319
+ control and status registers to applications, and to avoid giving the common
320
+ operations the possibility of having side effects.
321
+
322
+ Debugging techniques are also important, but they don't necessarily need to be
323
+ in the spec itself. Implementations are welcome (and encouraged) to support
324
+ non-standard execution modes, enabled only from developer tools, such as modes
325
+ with alternate rounding, or evaluation of floating point expressions at greater
326
+ precision, to support [ techniques for detecting numerical instability]
327
+ (http://www.cs.berkeley.edu/~wkahan/Mindless.pdf ).
328
+
329
+ To help developers find the sources of floating point exceptions,
330
+ implementations may wish to provide a mode where NaN values are produced with
331
+ payloads containing identifiers helping programmers locate where the NaNs first
332
+ appeared. Another option would be to offer another non-standard execution mode,
333
+ enabled only from developer tools, that would enable traps on selected floating
334
+ point exceptions, however care should be taken, since not all floating point
335
+ exceptions indicate bugs.
0 commit comments