| ... | ... | @@ -128,6 +128,7 @@ |
| 128 | 128 | } |
| 129 | 129 | .table-wrapper { |
| 130 | 130 | width: 100%; |
| 131 | margin: 1em auto; |
| 131 | 132 | overflow-x: auto; |
| 132 | 133 | } |
| 133 | 134 | |
| ... | ... | @@ -3471,6 +3472,42 @@ void do_a_thing(struct Foo *foo) { |
| 3471 | 3472 | without rounding (i.e. the integer's precision does not exceed the float's significand precision). |
| 3472 | 3473 | Larger integer types that cannot be safely coerced must be explicitly casted with {#link|@floatFromInt#}. |
| 3473 | 3474 | </p> |
| 3475 | <div class="table-wrapper"> |
| 3476 | <table> |
| 3477 | <thead> |
| 3478 | <tr> |
| 3479 | <th scope="col">Float Type</th> |
| 3480 | <th scope="col">Largest Integer Types</th> |
| 3481 | </tr> |
| 3482 | </thead> |
| 3483 | <tbody> |
| 3484 | <tr> |
| 3485 | <th scope="row">{#syntax#}f16{#endsyntax#}</th> |
| 3486 | <td>{#syntax#}i12{#endsyntax#} and {#syntax#}u11{#endsyntax#}</td> |
| 3487 | </tr> |
| 3488 | <tr> |
| 3489 | <th scope="row">{#syntax#}f32{#endsyntax#}</th> |
| 3490 | <td>{#syntax#}i25{#endsyntax#} and {#syntax#}u24{#endsyntax#}</td> |
| 3491 | </tr> |
| 3492 | <tr> |
| 3493 | <th scope="row">{#syntax#}f64{#endsyntax#}</th> |
| 3494 | <td>{#syntax#}i54{#endsyntax#} and {#syntax#}u53{#endsyntax#}</td> |
| 3495 | </tr> |
| 3496 | <tr> |
| 3497 | <th scope="row">{#syntax#}f80{#endsyntax#}</th> |
| 3498 | <td>{#syntax#}i65{#endsyntax#} and {#syntax#}u64{#endsyntax#}</td> |
| 3499 | </tr> |
| 3500 | <tr> |
| 3501 | <th scope="row">{#syntax#}f128{#endsyntax#}</th> |
| 3502 | <td>{#syntax#}i114{#endsyntax#} and {#syntax#}u113{#endsyntax#}</td> |
| 3503 | </tr> |
| 3504 | <tr> |
| 3505 | <th scope="row">{#syntax#}c_longdouble{#endsyntax#}</th> |
| 3506 | <td>Varies by target</td> |
| 3507 | </tr> |
| 3508 | </tbody> |
| 3509 | </table> |
| 3510 | </div> |
| 3474 | 3511 | {#code|test_int_to_float_coercion.zig#} |
| 3475 | 3512 | {#code|test_failed_int_to_float_coercion.zig#} |
| 3476 | 3513 | |