diff options
author | Robert Dewar <dewar@adacore.com> | 2012-11-06 09:55:50 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-11-06 10:55:50 +0100 |
commit | 0ce1ec64654b26a2417000c2710c52f6711f9ddb (patch) | |
tree | 95cfe11f8aab43afcc3d4601e798f0cde9eee8ea /gcc/ada/uintp.adb | |
parent | ed7b9d6ecfd1651d7c3fcd96f2b105bb2ba0349a (diff) | |
download | gcc-0ce1ec64654b26a2417000c2710c52f6711f9ddb.zip gcc-0ce1ec64654b26a2417000c2710c52f6711f9ddb.tar.gz gcc-0ce1ec64654b26a2417000c2710c52f6711f9ddb.tar.bz2 |
sem_prag.adb: Minor reformatting.
2012-11-06 Robert Dewar <dewar@adacore.com>
* sem_prag.adb: Minor reformatting.
2012-11-06 Robert Dewar <dewar@adacore.com>
* s-bignum.adb (Div_Rem): Fix bug in step D3.
* uintp.adb (UI_Div_Rem): Add comment on bug in step D3.
From-SVN: r193217
Diffstat (limited to 'gcc/ada/uintp.adb')
-rw-r--r-- | gcc/ada/uintp.adb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ada/uintp.adb b/gcc/ada/uintp.adb index a98bd9f..0761f2d 100644 --- a/gcc/ada/uintp.adb +++ b/gcc/ada/uintp.adb @@ -1216,6 +1216,15 @@ package body Uintp is -- [ CALCULATE Q (hat) ] (step D3 in the algorithm) + -- Note: this version of step D3 is from the original published + -- algorithm, which is known to have a bug causing overflows. + -- See: http://www-cs-faculty.stanford.edu/~uno/err2-2e.ps.gz. + -- In this code we are safe since our representation of double + -- length numbers allows an expanded range. + + -- We don't have a proof of this claim, but the only cases we + -- have found that show the bug in step D3 work fine here. + Tmp_Int := Dividend (J) * Base + Dividend (J + 1); -- Initial guess @@ -1230,7 +1239,7 @@ package body Uintp is while Divisor_Dig2 * Q_Guess > (Tmp_Int - Q_Guess * Divisor_Dig1) * Base + - Dividend (J + 2) + Dividend (J + 2) loop Q_Guess := Q_Guess - 1; end loop; |