Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`relaxed_trunc`: the symbol `R` is not defined

Closed
#2,269 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
wasm

Research direction

Read the relaxed truncation prose in document/core/exec/numerics.rst and compare it with the related SpecTec definitions in specification/wasm-latest/3.0-numerics.relaxed.spectec and 3.1-numerics.scalar.spectec. First determine the intended meaning of bold R and reconcile the parameter and result definitions with the prose. Done means the notation and SpecTec definitions consistently express the agreed behavior.

Written by the indexing model from the issue text.

Description

Since #1906, the prose says that on NaNs and out-of-range values, relaxed_trunc returns either the saturated result or $\mathbf{R}$, depending on the global parameter R_trunc_u / R_trunc_s.

$\mathbf{R}$ appears only in the sections for the unsigned and signed variants and is not defined anywhere in the document. It is also easy to confuse with the plain $R$ that the "Relaxed Operations" section uses for a global parameter in $\mathrm{relaxed}(R)[A_0, \dots, A_n] = A_R$.

https://github.com/WebAssembly/spec/blob/970c4116e644e2bf7acb39aab8b733db14ccdf28/document/core/exec/numerics.rst?plain=1#L2460-L2492

Question

Is $\mathbf{R}$ the set of all values of the result type, so that each execution may return any of them?

This reading seems consistent with the "Relaxed Operations" section, which says that each parameter is an index into a sequence of possible sets of results, and that the fixed operation can still be non-deterministic. #1906 also seems to suggest it: it changed the notes to "non-deterministic" and removed the test that checked that multiple calls with the same inputs return the same result.

If so, I think the prose should define it, e.g. "where $\mathbf{R}$ is the set of all values of the result type". I'm happy to open a PR.

Related: SpecTec

The SpecTec definitions were not updated by #1906:

Dominant language
WebAssembly
Stars
3.5k
Forks
540
Avg merge
1d 10h
Merged PRs (30d)
16

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from WebAssembly/spec

All issues in WebAssembly/spec

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.