diff --git a/doc/go_spec.html b/doc/go_spec.html index 0cc95bc64d..769231819c 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -3582,6 +3582,33 @@ IEEE-754 standard; whether a run-time panic occurs is implementation-specific.
++An implementation may combine multiple floating-point operations into a single +fused operation, possibly across statements, and produce a result that differs +from the value obtained by executing and rounding the instructions individually. +A floating-point type conversion explicitly rounds to +the precision of the target type, preventing fusion that would discard that rounding. +
+ +
+For instance, some architectures provide a "fused multiply and add" (FMA) instruction
+that computes x*y + z without rounding the intermediate result x*y.
+These examples show when a Go implementation can use that instruction:
+
+// FMA allowed for computing r, because x*y is not explicitly rounded: +r = x*y + z +r = z; r += x*y +t = x*y; r = t + z +*p = x*y; r = *p + z +r = x*y + float64(z) + +// FMA disallowed for computing r, because it would omit rounding of x*y: +r = float64(x*y) + z +r = z; r += float64(x*y) +t = float64(x*y); r = t + z +