Open bwbuhse opened 1 week ago
0.14.0-dev.1700+038e002b1
const std = @import("std"); pub fn main() void { const foo: u16 = 65535; const bar: f16 = foo; const baz: bool = (foo == bar); std.debug.print("{} {} {}\n", .{foo, bar, baz}); }
will output 65535 inf false
65535 inf false
https://zig.godbolt.org/z/aYGWobfa5
It looks like this started happening sometime after zig 0.9.0 (according to Godbolt).
Thanks to @GrayHatter and @torque for helping with this :smile:
A compile error like in zig 0.9.0:
./example.zig:5:22: error: type f16 cannot represent integer value 65535 const bar: f16 = foo; ^
that's supposed to be a compile error and require @floatFromInt
@floatFromInt
Zig Version
0.14.0-dev.1700+038e002b1
Steps to Reproduce and Observed Behavior
will output
65535 inf false
https://zig.godbolt.org/z/aYGWobfa5
It looks like this started happening sometime after zig 0.9.0 (according to Godbolt).
Thanks to @GrayHatter and @torque for helping with this :smile:
Expected Behavior
A compile error like in zig 0.9.0: