The doc of @setRuntimeSafety says:
The floating point mode is inherited by child scopes, and can be overridden in any scope. You can set the floating point mode in a struct or module scope by using a comptime block.
But it looks setting the floating point mode in a struct or module scope by using a comptime block doesn’t work.
var x: f64 = 0.0;
comptime {
@setFloatMode(.optimized); // Not work.
}
pub fn main() void {
//@setFloatMode(.optimized); // This line works.
const y = 0.0 / x;
@import("std").debug.print("{}\n", .{y});
}