Rule 9.4
Chapter 9, Built-in functions and the TypeShade extensions Test
A Math member and its free-function spelling must lower to the WGSL builtin of the same meaning; a Math member with no WGSL builtin must be expanded into WGSL arithmetic and stays an ECMAScript name; Math.fround(x) is f32(x).
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
see Rule 2.4.
Derives from
MATH_FN_ALIAS and MATH_EXPAND_ALIAS in src/compiler/ts/math-alias.ts.
How it is verified
Checked by a test. A test, a gate script or a CI workflow names this rule, and the traceability check fails when a file listed below stops naming it.
Where the rule says the compiler enforces it:
surface-names.test.ts and src/compiler/ts/math-expand.test.ts.
The files that verify it at commit 26de7be8, each at the first line that names the rule:
See also
Source
The rule at commit 26de7be8:
docs/language-design.md:932(the design document)reqs/rules/RULE-0904.md(its traceability item)