forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdecbe2b
committed
Fix behavior of exp() and power() for infinity inputs.
Previously, these functions tended to throw underflow errors fornegative-infinity exponents. The correct thing per POSIX is toreturn 0, so let's do that instead. (Note that the SQL standardis silent on such issues, as it lacks the concepts of either Infor NaN; so our practice is to follow POSIX whenever a correspondingC-library function exists.)Also, add a bunch of test cases verifying that exp() and power()actually do follow POSIX for Inf and NaN inputs. While this patchshould guarantee that exp() passes the tests, power() will not unlessthe platform's pow(3) is fully POSIX-compliant. I already know thatgaur fails some of the tests, and I am suspicious that the Windowsanimals will too; the extent of compliance of other old platformsremains to be seen. We might choose to drop failing test cases, orto work harder at overriding pow(3) for these cases, but first let'ssee just how good or bad the situation is.Discussion:https://postgr.es/m/582552.1591917752@sss.pgh.pa.us1 parent378badc commitdecbe2b
File tree
3 files changed
+221
-10
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+221
-10
lines changedLines changed: 33 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1565 | 1565 |
| |
1566 | 1566 |
| |
1567 | 1567 |
| |
1568 |
| - | |
| 1568 | + | |
1569 | 1569 |
| |
1570 | 1570 |
| |
1571 | 1571 |
| |
| |||
1581 | 1581 |
| |
1582 | 1582 |
| |
1583 | 1583 |
| |
1584 |
| - | |
1585 |
| - | |
1586 |
| - | |
1587 |
| - | |
1588 |
| - | |
1589 |
| - | |
1590 |
| - | |
1591 |
| - | |
1592 |
| - | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
1593 | 1616 |
| |
1594 | 1617 |
| |
1595 | 1618 |
| |
|
Lines changed: 159 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
385 | 385 |
| |
386 | 386 |
| |
387 | 387 |
| |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
388 | 540 |
| |
389 | 541 |
| |
390 | 542 |
| |
| |||
396 | 548 |
| |
397 | 549 |
| |
398 | 550 |
| |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
399 | 558 |
| |
400 | 559 |
| |
401 | 560 |
| |
|
Lines changed: 29 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
120 | 120 |
| |
121 | 121 |
| |
122 | 122 |
| |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
123 | 149 |
| |
124 | 150 |
| |
125 | 151 |
| |
126 | 152 |
| |
127 | 153 |
| |
128 | 154 |
| |
| 155 | + | |
| 156 | + | |
| 157 | + | |
129 | 158 |
| |
130 | 159 |
| |
131 | 160 |
| |
|
0 commit comments
Comments
(0)