forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf397e08
committed
Use strtof() and not strtod() for float4 input.
Using strtod() creates a double-rounding problem; the input decimalvalue is first rounded to the nearest double; rounding that to thenearest float may then give an incorrect result.An example is that 7.038531e-26 when input via strtod and then roundedto float4 gives 0xAE43FEp-107 instead of the correct 0xAE43FDp-107.Values output by earlier PG versions with extra_float_digits=3 shouldall be read in with the same values as previously. However, valuessupplied by other software using shortest representations could bemis-read.On platforms that lack a strtof() entirely, we fall back to the oldincorrect rounding behavior. (As strtof() is required by C99, suchplatforms are considered of primarily historical interest.) On VS2013,some workarounds are used to get correct error handling.The regression tests now test for the correct input values, soplatforms that lack strtof() will need resultmap entries. An entry forHP-UX 10 is included (more may be needed).Reviewed-By: Tom LaneDiscussion:https://postgr.es/m/871s5emitx.fsf@news-spur.riddles.org.ukDiscussion:https://postgr.es/m/87d0owlqpv.fsf@news-spur.riddles.org.uk1 parent37d9916 commitf397e08
File tree
13 files changed
+810
-17
lines changed- src
- backend/utils/adt
- include
- port
- port
- test/regress
- expected
- sql
- tools/msvc
13 files changed
+810
-17
lines changedLines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15805 | 15805 |
| |
15806 | 15806 |
| |
15807 | 15807 |
| |
| 15808 | + | |
| 15809 | + | |
| 15810 | + | |
| 15811 | + | |
| 15812 | + | |
| 15813 | + | |
| 15814 | + | |
| 15815 | + | |
| 15816 | + | |
| 15817 | + | |
| 15818 | + | |
| 15819 | + | |
| 15820 | + | |
15808 | 15821 |
| |
15809 | 15822 |
| |
15810 | 15823 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1705 | 1705 |
| |
1706 | 1706 |
| |
1707 | 1707 |
| |
| 1708 | + | |
1708 | 1709 |
| |
1709 | 1710 |
| |
1710 | 1711 |
| |
|
Lines changed: 43 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
107 | 133 |
| |
108 | 134 |
| |
109 | 135 |
| |
110 | 136 |
| |
111 | 137 |
| |
112 | 138 |
| |
113 |
| - | |
| 139 | + | |
114 | 140 |
| |
115 | 141 |
| |
116 | 142 |
| |
| |||
135 | 161 |
| |
136 | 162 |
| |
137 | 163 |
| |
138 |
| - | |
| 164 | + | |
139 | 165 |
| |
140 | 166 |
| |
141 | 167 |
| |
142 | 168 |
| |
143 | 169 |
| |
144 | 170 |
| |
145 | 171 |
| |
146 |
| - | |
| 172 | + | |
147 | 173 |
| |
148 | 174 |
| |
149 |
| - | |
| 175 | + | |
150 | 176 |
| |
151 | 177 |
| |
152 | 178 |
| |
153 |
| - | |
| 179 | + | |
154 | 180 |
| |
155 | 181 |
| |
156 | 182 |
| |
| |||
195 | 221 |
| |
196 | 222 |
| |
197 | 223 |
| |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
198 | 228 |
| |
199 |
| - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
200 | 236 |
| |
201 | 237 |
| |
202 | 238 |
| |
| |||
232 | 268 |
| |
233 | 269 |
| |
234 | 270 |
| |
235 |
| - | |
236 |
| - | |
237 |
| - | |
238 |
| - | |
239 |
| - | |
240 |
| - | |
241 |
| - | |
| 271 | + | |
242 | 272 |
| |
243 | 273 |
| |
244 | 274 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
555 | 555 |
| |
556 | 556 |
| |
557 | 557 |
| |
| 558 | + | |
| 559 | + | |
| 560 | + | |
558 | 561 |
| |
559 | 562 |
| |
560 | 563 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
139 | 139 |
| |
140 | 140 |
| |
141 | 141 |
| |
| 142 | + | |
| 143 | + | |
| 144 | + | |
142 | 145 |
| |
143 | 146 |
| |
144 | 147 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
381 | 381 |
| |
382 | 382 |
| |
383 | 383 |
| |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
384 | 388 |
| |
385 | 389 |
| |
386 | 390 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
510 | 510 |
| |
511 | 511 |
| |
512 | 512 |
| |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
513 | 525 |
| |
514 | 526 |
| |
515 | 527 |
| |
|
Lines changed: 123 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 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 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + |
0 commit comments
Comments
(0)