forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8597a48
committed
Fix FPeq() and friends to get the right answers for infinities.
"FPeq(infinity, infinity)" returned false, on account of getting NaNwhen it subtracts the two inputs. Fix that by adding a separatecheck for exact equality.FPle() and FPge() similarly got the wrong answer for two like-signedinfinities. In those cases, we can just rearrange the comparisonsto avoid potentially subtracting infinities.While the sibling functions FPne() etc accidentally gave the rightanswers even with the internal NaN results, it seems best to makesimilar adjustments to them to avoid depending on this.FPeq() has to be converted to an inline function to avoid doubleevaluations of its arguments, and I did the same for the othersjust for consistency.In passing, make the handling of NaN cases in line_eq() andpoint_eq_point() simpler and easier to reason about, and perhapsfaster.This results in just one visible regression test change: slope()now gives DBL_MAX for two inputs of (inf,1e300), which is consistentwith what it does for (1e300,inf), so that seems like a bug fix.Discussion:https://postgr.es/m/CAGf+fX70rWFOk5cd00uMfa__0yP+vtQg5ck7c2Onb-Yczp0URA@mail.gmail.com1 parenta45272b commit8597a48
File tree
3 files changed
+72
-26
lines changed- src
- backend/utils/adt
- include/utils
- test/regress/expected
3 files changed
+72
-26
lines changedLines changed: 22 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1155 | 1155 |
| |
1156 | 1156 |
| |
1157 | 1157 |
| |
1158 |
| - | |
1159 |
| - | |
1160 |
| - | |
1161 | 1158 |
| |
1162 | 1159 |
| |
1163 | 1160 |
| |
| |||
1166 | 1163 |
| |
1167 | 1164 |
| |
1168 | 1165 |
| |
1169 |
| - | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
1170 | 1177 |
| |
1171 |
| - | |
| 1178 | + | |
1172 | 1179 |
| |
1173 |
| - | |
| 1180 | + | |
1174 | 1181 |
| |
1175 | 1182 |
| |
1176 | 1183 |
| |
1177 | 1184 |
| |
1178 |
| - | |
1179 |
| - | |
1180 |
| - | |
1181 |
| - | |
1182 |
| - | |
1183 |
| - | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
1184 | 1188 |
| |
1185 | 1189 |
| |
1186 | 1190 |
| |
| |||
1930 | 1934 |
| |
1931 | 1935 |
| |
1932 | 1936 |
| |
1933 |
| - | |
1934 |
| - | |
1935 |
| - | |
1936 | 1937 |
| |
1937 | 1938 |
| |
1938 | 1939 |
| |
1939 | 1940 |
| |
1940 |
| - | |
1941 |
| - | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
1942 | 1947 |
| |
1943 | 1948 |
| |
1944 | 1949 |
| |
|
Lines changed: 49 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
| 21 | + | |
| 22 | + | |
21 | 23 |
| |
22 | 24 |
| |
23 | 25 |
| |
24 | 26 |
| |
25 |
| - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 |
| |
27 |
| - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
28 | 39 |
| |
29 | 40 |
| |
30 | 41 |
| |
31 | 42 |
| |
32 | 43 |
| |
33 | 44 |
| |
34 |
| - | |
35 |
| - | |
36 |
| - | |
37 |
| - | |
38 |
| - | |
39 |
| - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
40 | 81 |
| |
41 | 82 |
| |
42 | 83 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
190 | 190 |
| |
191 | 191 |
| |
192 | 192 |
| |
193 |
| - | |
| 193 | + | |
194 | 194 |
| |
195 | 195 |
| |
196 | 196 |
| |
|
0 commit comments
Comments
(0)