Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions wgsl/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,18 @@ literal_or_ident
The third parameter, if provided, specifies the z dimension, otherwise is assumed to be 1.
Each dimension must be at least 1 and at most an upper bound specified by the WebGPU API.

<tr><td><dfn noexport dfn-for="attribute">`precise_math`</dfn>
<td>*None*

Indicates that the arithmetic computations in the function should be performed
under stricter [[#floating-point-evaluation]]:
* without [=Reassociation|reassociating=] subexpressions

Note: this translates to `NoContraction` decoration in SPIR-V, `precise` qualifier in HLSL,
and a subset of `"-fno-fast-math" group of compile options in MSL.

This attribute doesn't recursively affect other functions called from the current function.

</table>


Expand Down Expand Up @@ -5378,6 +5390,7 @@ param
[SHORTNAME] defines the following attributes that can be applied to function declarations:
* [=attribute/stage=]
* [=attribute/workgroup_size=]
* [=attribute/precise_math=]

[SHORTNAME] defines the following attributes that can be applied to function
parameters and return types:
Expand Down Expand Up @@ -6238,6 +6251,9 @@ the following exceptions:
* Other operations are required to preserve denormalized numbers.
* The accuracy of operations is given in [[#floating-point-accuracy]].

[SHORTNAME] attemps to reduce the scope of applied exceptions to floating-point operations
in functions with [=attribute/precise_math=] attributes.

### Floating Point Accuracy ### {#floating-point-accuracy}

<div algorithm="correctly rounded">
Expand Down