From 82499ce3100302ae728c1566fd1f62df7ecc5405 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Mon, 16 Jan 2023 13:48:59 -0800 Subject: [PATCH] clarify the required accuracy for OpFMod and OpFRem --- OpenCL_Env.txt | 5 +++++ env/footnotes.asciidoc | 16 ++++++++++++++++ env/numerical_compliance.asciidoc | 14 +++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 env/footnotes.asciidoc diff --git a/OpenCL_Env.txt b/OpenCL_Env.txt index e4371d4f..8b2c2ff4 100644 --- a/OpenCL_Env.txt +++ b/OpenCL_Env.txt @@ -28,6 +28,11 @@ include::config/opencl.asciidoc[] // Formatting and links for API functions and enums. include::env/dictionary.asciidoc[] +// External Footnotes +include::env/footnotes.asciidoc[] + +<<< + include::copyrights.txt[] <<< diff --git a/env/footnotes.asciidoc b/env/footnotes.asciidoc new file mode 100644 index 00000000..ed98e6a1 --- /dev/null +++ b/env/footnotes.asciidoc @@ -0,0 +1,16 @@ +// Copyright 2023 The Khronos Group. This work is licensed under a +// Creative Commons Attribution 4.0 International License; see +// http://creativecommons.org/licenses/by/4.0/ + +// Please keep footnotes in alphabetical order! + +// Note: Follows the suggested syntax from: +// https://github.com/asciidoctor/asciidoctor-pdf/issues/1397 + +:fn-opfrem-opfmod: pass:n[ \ +The *OpFRem* and *OpFMod* instructions use cheap approximations of remainder, and the error can be large due to the discontinuity in *trunc*() and *floor*(). This can produce mathematically unexpected results in some cases, such as *OpFMod*(x,x) computing x rather than 0, and can also cause the result to have a different sign than the infinitely precise result. \ +] + +:fn-type-min: pass:n[ \ +Here `TYPE_MIN` and `TYPE_MIN_EXP` should be substituted by constants appropriate to the floating-point type under consideration, such as `FLT_MIN` and `FLT_MIN_EXP` for float. \ +] diff --git a/env/numerical_compliance.asciidoc b/env/numerical_compliance.asciidoc index a29bc8b6..3e614437 100644 --- a/env/numerical_compliance.asciidoc +++ b/env/numerical_compliance.asciidoc @@ -198,6 +198,16 @@ devices given as ULP values. | \<= 2.5 ulp | Correctly rounded +| *OpFRem*(x, y) +| Derived from x - y * *trunc*(x/y) footnote:opfrem-opfmod[{fn-opfrem-opfmod}] +| Derived from x - y * *trunc*(x/y) footnote:opfrem-opfmod[] +| Derived from x - y * *trunc*(x/y) footnote:opfrem-opfmod[] + +| *OpFMod*(x, y) +| Derived from x - y * *floor*(x/y) footnote:opfrem-opfmod[] +| Derived from x - y * *floor*(x/y) footnote:opfrem-opfmod[] +| Derived from x - y * *floor*(x/y) footnote:opfrem-opfmod[] + | *OpExtInst* *acos* | \<= 4 ulp | \<= 4 ulp @@ -1782,6 +1792,4 @@ representable numbers in the range 0 < x < TYPE_MIN and -TYPE_MIN < x < -0. They do not include {plusmn}0. A non-zero number is said to be sub-normal before rounding if, after normalization, its radix-2 exponent is less than (TYPE_MIN_EXP - 1). -footnote:[Here `TYPE_MIN` and `TYPE_MIN_EXP` should be substituted by -constants appropriate to the floating-point type under consideration, such -as `FLT_MIN` and `FLT_MIN_EXP` for float.] +footnote:[{fn-type-min}]