 / Check-in [438e1577]

 ```360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 ``` ``` /* In the IEEE 754 standard, zero is signed. ** Add the sign if we've seen at least one digit */ result = (sign<0 && nDigits) ? -(double)0 : (double)0; } else { /* attempt to reduce exponent */ if( esign>0 ){ while( s<(LARGEST_INT64/10) && e>0 ) e--,s*=10; } /* adjust the sign of significand */ s = sign<0 ? -s : s; /* if exponent, scale significand as appropriate ** and store in result. */ if( e ){ double scale = 1.0; while( e>=16 ){ scale *= 1.0e+16; e -= 16; } while( e>=4 ){ scale *= 1.0e+4; e -= 4; } while( e>=1 ){ scale *= 1.0e+1; e -= 1; } if( esign<0 ){ result = s / scale; }else{ result = s * scale; } } else { result = (double)s; ``` ``` > > | > | | ``` ```360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 ``` ``` /* In the IEEE 754 standard, zero is signed. ** Add the sign if we've seen at least one digit */ result = (sign<0 && nDigits) ? -(double)0 : (double)0; } else { /* attempt to reduce exponent */ if( esign>0 ){ while( s<(LARGEST_INT64/10) && e>0 ) e--,s*=10; }else{ while( !(s%10) && e>0 ) e--,s/=10; } /* adjust the sign of significand */ s = sign<0 ? -s : s; /* if exponent, scale significand as appropriate ** and store in result. */ if( e ){ double scale = 1.0; /* 1.0e+22 is the largest power of 10 than can be ** represented exactly. */ while( e%22 ) { scale *= 1.0e+1; e -= 1; } while( e>0 ) { scale *= 1.0e+22; e -= 22; } if( esign<0 ){ result = s / scale; }else{ result = s * scale; } } else { result = (double)s; ```