1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

Make the round() function work correctly on numbers with very large exponents.

Ticket #1340. (CVS 2585)

FossilOrigin-Name: 4f47c3c884e38b810450b6127ab33c7b86e6743c
This commit is contained in:
drh
2005-08-13 03:07:47 +00:00
parent 42b9d7c561
commit 592ac8cb6c
5 changed files with 20 additions and 13 deletions

View File

@@ -436,6 +436,7 @@ static int vxprintf(
/* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
exp = 0;
if( realvalue>0.0 ){
while( realvalue>=1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; }
while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; }
while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; }
while( realvalue<1e-8 && exp>=-350 ){ realvalue *= 1e8; exp-=8; }