From 97986184ca67abdb877bda39707dd129ed6473ae Mon Sep 17 00:00:00 2001 From: Jay Petacat Date: Sat, 24 Jan 2026 11:49:26 -0700 Subject: [PATCH] langref: Add table of largest integer types that can coerce to floats Add vertical margin to the `.table-wrapper` class so that there's space between the table and the test figures. It does not affect any of the existing tables because the margin collapses with the adjacent `

`. --- doc/langref.html.in | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/doc/langref.html.in b/doc/langref.html.in index 3671047ec0f3e0db8dad982a2e6f07871292e504..e87decdf4a9ab51de65bc8ae0c8d6a8378b47dcd 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -128,6 +128,7 @@ } .table-wrapper { width: 100%; + margin: 1em auto; overflow-x: auto; } @@ -3471,6 +3472,42 @@ void do_a_thing(struct Foo *foo) { without rounding (i.e. the integer's precision does not exceed the float's significand precision). Larger integer types that cannot be safely coerced must be explicitly casted with {#link|@floatFromInt#}.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Float TypeLargest Integer Types
{#syntax#}f16{#endsyntax#}{#syntax#}i12{#endsyntax#} and {#syntax#}u11{#endsyntax#}
{#syntax#}f32{#endsyntax#}{#syntax#}i25{#endsyntax#} and {#syntax#}u24{#endsyntax#}
{#syntax#}f64{#endsyntax#}{#syntax#}i54{#endsyntax#} and {#syntax#}u53{#endsyntax#}
{#syntax#}f80{#endsyntax#}{#syntax#}i65{#endsyntax#} and {#syntax#}u64{#endsyntax#}
{#syntax#}f128{#endsyntax#}{#syntax#}i114{#endsyntax#} and {#syntax#}u113{#endsyntax#}
{#syntax#}c_longdouble{#endsyntax#}Varies by target
+
{#code|test_int_to_float_coercion.zig#} {#code|test_failed_int_to_float_coercion.zig#} -- 2.54.0