forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita0fad97
committed
Re-implement division for numeric values using the traditional "schoolbook"
algorithm. This is a good deal slower than our old roundoff-error-pronecode for long inputs, so we keep the old code for use in the transcendentalfunctions, where everything is approximate anyway. Also create auser-accessible function div(numeric, numeric) to provide access to theexact result of trunc(x/y) --- since the regular numeric / operator willround off its result, simply computing that expression in SQL doesn'treliably give the desired answer. This fixes bug #3387 and various relatedcorner cases, and improves the usefulness of PG for high-precision integerarithmetic.1 parentb6f0ad4 commita0fad97
File tree
7 files changed
+470
-32
lines changed- doc/src/sgml
- src
- backend/utils/adt
- include
- catalog
- utils
- test/regress
- expected
- sql
7 files changed
+470
-32
lines changedLines changed: 13 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| |||
617 | 617 |
| |
618 | 618 |
| |
619 | 619 |
| |
| 620 | + | |
| 621 | + | |
| 622 | + | |
620 | 623 |
| |
621 | 624 |
| |
622 | 625 |
| |
| |||
717 | 720 |
| |
718 | 721 |
| |
719 | 722 |
| |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
720 | 732 |
| |
721 | 733 |
| |
722 | 734 |
| |
|
0 commit comments
Comments
(0)