diff --git a/doc/langref.html.in b/doc/langref.html.in index d3db8079b5..b08e859f95 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -10387,7 +10387,26 @@ fn bar(f: *Foo) void { {#header_close#} {#header_open|Out of Bounds Float to Integer Cast#} -
TODO
++ This happens when casting a float to an integer where the float has a value outside the + integer type's range. +
+At compile-time:
+ {#code_begin|test_err|test_comptime_out_of_bounds_float_to_integer_cast|float value '4294967296' cannot be stored in integer type 'i32'#} +comptime { + const float: f32 = 4294967296; + const int: i32 = @intFromFloat(float); + _ = int; +} + {#code_end#} +At runtime:
+ {#code_begin|exe_err|runtime_out_of_bounds_float_to_integer_cast#} +pub fn main() void { + var float: f32 = 4294967296; + var int: i32 = @intFromFloat(float); + _ = int; +} + {#code_end#} {#header_close#} {#header_open|Pointer Cast Invalid Null#}