mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Clarify condusing wording regarding % and /
Previous wording made it seem like any signed or floating-point value would be allowed at comptime, whereas negative values do not work with `%`, and negative integers do not work with `/`.
This commit is contained in:
parent
ca282184ae
commit
49ca51fc3a
1 changed files with 4 additions and 4 deletions
|
|
@ -1300,10 +1300,10 @@ a /= b{#endsyntax#}</pre></td>
|
|||
<li>Can cause {#link|overflow|Default Operations#} for integers.</li>
|
||||
<li>Can cause {#link|Division by Zero#} for integers.</li>
|
||||
<li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li>
|
||||
<li>For non-compile-time-known signed integers, must use
|
||||
<li>Signed integer operands must be comptime-known and positive. In other cases, use
|
||||
{#link|@divTrunc#},
|
||||
{#link|@divFloor#}, or
|
||||
{#link|@divExact#} instead of {#syntax#}/{#endsyntax#}.
|
||||
{#link|@divExact#} instead.
|
||||
</li>
|
||||
<li>Invokes {#link|Peer Type Resolution#} for the operands.</li>
|
||||
</ul>
|
||||
|
|
@ -1325,9 +1325,9 @@ a %= b{#endsyntax#}</pre></td>
|
|||
<ul>
|
||||
<li>Can cause {#link|Division by Zero#} for integers.</li>
|
||||
<li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li>
|
||||
<li>For non-compile-time-known signed integers, must use
|
||||
<li>Signed or floating-point operands must be comptime-known and positive. In other cases, use
|
||||
{#link|@rem#} or
|
||||
{#link|@mod#} instead of {#syntax#}%{#endsyntax#}.
|
||||
{#link|@mod#} instead.
|
||||
</li>
|
||||
<li>Invokes {#link|Peer Type Resolution#} for the operands.</li>
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue