Open jiacai2050 opened 3 months ago
In Zig, when you perform an operation between two integers and the result should be a floating point number, Zig first performs the operation between integers and then implicitly converts the result to a floating point if necessary.
In the expression 1/2 * 0.1
, division 1/2
results in 0
, which is an integer. However, when the 0 * 0.1
operation is performed, Zig implicitly converts the integer 0
to a floating point (0.0) so that multiplication can be performed between two floating point numbers, thus avoiding type errors.
bug?
const dd: f64 = @divxxx(1.0, 60.0f64) always 0,
But 1.0 / 60.0 is ok.
Zig Version
0.12.0-dev.3533+e5d900268
Steps to Reproduce and Observed Behavior
This will output
This seems quite confusing.
Since this will throw error when compile according to docs here, I think v1 should also throw errors.
Expected Behavior
V1 should throw error when compile.