mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-12 17:37:07 +08:00
Remove underflow error in float division with infinite divisor.
float4_div and float8_div correctly produced zero for zero divided by infinity, but threw an underflow error for nonzero finite values divided by infinity. This seems wrong; at the very least it's inconsistent with the behavior recently implemented for numeric infinities. Remove the error and allow zero to be returned. This patch also removes a useless isinf() test from the overflow checks in these functions (non-Inf divided by Inf can't produce Inf). Extracted from a larger patch; this seems significant outside the context of geometric operators, so it deserves its own commit. Kyotaro Horiguchi Discussion: https://postgr.es/m/CAGf+fX70rWFOk5cd00uMfa__0yP+vtQg5ck7c2Onb-Yczp0URA@mail.gmail.com
This commit is contained in:
@ -49,6 +49,7 @@ SELECT ' INFINITY x'::float4;
|
||||
|
||||
SELECT 'Infinity'::float4 + 100.0;
|
||||
SELECT 'Infinity'::float4 / 'Infinity'::float4;
|
||||
SELECT '42'::float4 / 'Infinity'::float4;
|
||||
SELECT 'nan'::float4 / 'nan'::float4;
|
||||
SELECT 'nan'::float4 / '0'::float4;
|
||||
SELECT 'nan'::numeric::float4;
|
||||
|
||||
Reference in New Issue
Block a user