authorgravatar for eleanor@eleanor-nb.comEleanor Bartle <eleanor@eleanor-nb.com> 2020-12-19 00:04:03+11:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-12-23 17:05:37+02:00
log49ca51fc3ac35ee3ab25cdad9747c9c0719ffe5e
tree6168be7953ad4d7ddde818b0b94588c475eb8e98
parentca282184ae4f02aa1eec8cf1301df89accbb4e1b

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 `/`.

1 files changed, 4 insertions(+), 4 deletions(-)

doc/langref.html.in+4-4
...@@ -1300,10 +1300,10 @@ a /= b{#endsyntax#}</pre></td>...@@ -1300,10 +1300,10 @@ a /= b{#endsyntax#}</pre></td>
1300 <li>Can cause {#link|overflow|Default Operations#} for integers.</li>1300 <li>Can cause {#link|overflow|Default Operations#} for integers.</li>
1301 <li>Can cause {#link|Division by Zero#} for integers.</li>1301 <li>Can cause {#link|Division by Zero#} for integers.</li>
1302 <li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li>1302 <li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li>
1303 <li>For non-compile-time-known signed integers, must use1303 <li>Signed integer operands must be comptime-known and positive. In other cases, use
1304 {#link|@divTrunc#},1304 {#link|@divTrunc#},
1305 {#link|@divFloor#}, or1305 {#link|@divFloor#}, or
1306 {#link|@divExact#} instead of {#syntax#}/{#endsyntax#}.1306 {#link|@divExact#} instead.
1307 </li>1307 </li>
1308 <li>Invokes {#link|Peer Type Resolution#} for the operands.</li>1308 <li>Invokes {#link|Peer Type Resolution#} for the operands.</li>
1309 </ul>1309 </ul>
...@@ -1325,9 +1325,9 @@ a %= b{#endsyntax#}</pre></td>...@@ -1325,9 +1325,9 @@ a %= b{#endsyntax#}</pre></td>
1325 <ul>1325 <ul>
1326 <li>Can cause {#link|Division by Zero#} for integers.</li>1326 <li>Can cause {#link|Division by Zero#} for integers.</li>
1327 <li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li>1327 <li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li>
1328 <li>For non-compile-time-known signed integers, must use1328 <li>Signed or floating-point operands must be comptime-known and positive. In other cases, use
1329 {#link|@rem#} or1329 {#link|@rem#} or
1330 {#link|@mod#} instead of {#syntax#}%{#endsyntax#}.1330 {#link|@mod#} instead.
1331 </li>1331 </li>
1332 <li>Invokes {#link|Peer Type Resolution#} for the operands.</li>1332 <li>Invokes {#link|Peer Type Resolution#} for the operands.</li>
1333 </ul>1333 </ul>