| ... | ... | @@ -1118,8 +1118,8 @@ |
| 1118 | 1118 | |
| 1119 | 1119 | {#header_close#} |
| 1120 | 1120 | {#header_open|Floating Point Operations#} |
| 1121 | | <p>By default floating point operations use {#syntax#}Strict{#endsyntax#} mode, |
| 1122 | | but you can switch to {#syntax#}Optimized{#endsyntax#} mode on a per-block basis:</p> |
| 1121 | <p>By default floating point operations use {#syntax#}.strict{#endsyntax#} mode, |
| 1122 | but you can switch to {#syntax#}.optimized{#endsyntax#} mode on a per-block basis:</p> |
| 1123 | 1123 | {#code|float_mode_obj.zig#} |
| 1124 | 1124 | |
| 1125 | 1125 | <p>For this test we have to separate code into two object files - |
| ... | ... | @@ -1374,7 +1374,7 @@ a /= b{#endsyntax#}</pre></td> |
| 1374 | 1374 | <ul> |
| 1375 | 1375 | <li>Can cause {#link|overflow|Default Operations#} for integers.</li> |
| 1376 | 1376 | <li>Can cause {#link|Division by Zero#} for integers.</li> |
| 1377 | | <li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li> |
| 1377 | <li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.optimized Mode|Floating Point Operations#}.</li> |
| 1378 | 1378 | <li>Signed integer operands must be comptime-known and positive. In other cases, use |
| 1379 | 1379 | {#link|@divTrunc#}, |
| 1380 | 1380 | {#link|@divFloor#}, or |
| ... | ... | @@ -1400,7 +1400,7 @@ a %= b{#endsyntax#}</pre></td> |
| 1400 | 1400 | <td> |
| 1401 | 1401 | <ul> |
| 1402 | 1402 | <li>Can cause {#link|Division by Zero#} for integers.</li> |
| 1403 | | <li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li> |
| 1403 | <li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.optimized Mode|Floating Point Operations#}.</li> |
| 1404 | 1404 | <li>Signed or floating-point operands must be comptime-known and positive. In other cases, use |
| 1405 | 1405 | {#link|@rem#} or |
| 1406 | 1406 | {#link|@mod#} instead. |
| ... | ... | @@ -5423,10 +5423,10 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val |
| 5423 | 5423 | <p>Changes the current scope's rules about how floating point operations are defined.</p> |
| 5424 | 5424 | <ul> |
| 5425 | 5425 | <li> |
| 5426 | | {#syntax#}Strict{#endsyntax#} (default) - Floating point operations follow strict IEEE compliance. |
| 5426 | {#syntax#}.strict{#endsyntax#} (default) - Floating point operations follow strict IEEE compliance. |
| 5427 | 5427 | </li> |
| 5428 | 5428 | <li> |
| 5429 | | {#syntax#}Optimized{#endsyntax#} - Floating point operations may do all of the following: |
| 5429 | {#syntax#}.optimized{#endsyntax#} - Floating point operations may do all of the following: |
| 5430 | 5430 | <ul> |
| 5431 | 5431 | <li>Assume the arguments and result are not NaN. Optimizations are required to retain legal behavior over NaNs, but the value of the result is undefined.</li> |
| 5432 | 5432 | <li>Assume the arguments and result are not +/-Inf. Optimizations are required to retain legal behavior over +/-Inf, but the value of the result is undefined.</li> |
| ... | ... | @@ -5600,7 +5600,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val |
| 5600 | 5600 | Note that {#syntax#}.Add{#endsyntax#} and {#syntax#}.Mul{#endsyntax#} |
| 5601 | 5601 | reductions on integral types are wrapping; when applied on floating point |
| 5602 | 5602 | types the operation associativity is preserved, unless the float mode is |
| 5603 | | set to {#syntax#}Optimized{#endsyntax#}. |
| 5603 | set to {#syntax#}.optimized{#endsyntax#}. |
| 5604 | 5604 | </p> |
| 5605 | 5605 | {#code|test_reduce_builtin.zig#} |
| 5606 | 5606 | |