diff options
author | Daniel Fischer <daniel.fischer@oracle.com> | 2011-09-23 12:18:15 +0200 |
---|---|---|
committer | Daniel Fischer <daniel.fischer@oracle.com> | 2011-09-23 12:18:15 +0200 |
commit | 64d914cedb17cce2fc4dffbe82e197b76946a818 (patch) | |
tree | 943a147078cea868d8a63dd7a2f310db6a521be7 /strings | |
parent | 8e56eb58ec16df6320f514f93deaba1c6c4d006f (diff) | |
parent | f9b064a406a9836cac109c5dcdd9354cbb4303b7 (diff) | |
download | mariadb-git-64d914cedb17cce2fc4dffbe82e197b76946a818.tar.gz |
merge
Diffstat (limited to 'strings')
-rw-r--r-- | strings/dtoa.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/strings/dtoa.c b/strings/dtoa.c index 05c9bb6e529..f7c38b2420d 100644 --- a/strings/dtoa.c +++ b/strings/dtoa.c @@ -1009,6 +1009,7 @@ static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc) Bigint *b1, *p5, *p51=NULL; int i; static int p05[3]= { 5, 25, 125 }; + my_bool overflow= FALSE; if ((i= k & 3)) b= multadd(b, p05[i-1], 0, alloc); @@ -1027,16 +1028,19 @@ static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc) if (!(k>>= 1)) break; /* Calculate next power of 5 */ - if (p5 < p5_a + P5A_MAX) - ++p5; - else if (p5 == p5_a + P5A_MAX) - p5= mult(p5, p5, alloc); - else + if (overflow) { p51= mult(p5, p5, alloc); Bfree(p5, alloc); p5= p51; } + else if (p5 < p5_a + P5A_MAX) + ++p5; + else if (p5 == p5_a + P5A_MAX) + { + p5= mult(p5, p5, alloc); + overflow= TRUE; + } } if (p51) Bfree(p51, alloc); |