Divide by 0 undefined in C99
Closed this issue · 1 comments
thatcosmonaut commented
The C99 spec states that
The result of the / operator is the quotient from the division of the first operand by the second; the result of the % operator is the remainder. In both operations, if the value of the second operand is zero, the behavior is undefined.
In qoaconv.c L270:
double psnr = 1.0/0.0;
This refuses to compile on some compilers like MSVC.
Changing 1.0/0.0
to the INFINITY macro seems to work fine.
PallHaraldsson commented
Fixed here to NaN 66ee62d then later to INFINITY. The line number is different, since it must have moved, I do not see such elsewhere.