リビジョン | aea5438abb1dccee588872e16b4569a0be8900f4 (tree) |
---|---|
日時 | 2018-10-13 03:33:25 |
作者 | Agustina Arzille <avarzille@rise...> |
コミッター | Agustina Arzille |
Refactor name
@@ -370,7 +370,7 @@ | ||
370 | 370 | } |
371 | 371 | |
372 | 372 | static int |
373 | -write_flt (interpreter *interp, stream *strm, double ldbl, | |
373 | +write_flt (interpreter *interp, stream *strm, double dbl, | |
374 | 374 | int width, int prec, int flags, int radix) |
375 | 375 | { |
376 | 376 | uint32_t space[(DBL_MANT_DIG + 28) / 29 + 1 + |
@@ -382,8 +382,8 @@ | ||
382 | 382 | char *ebuf = ebuf_st + sizeof (ebuf_st), *estr; |
383 | 383 | const char *prefix = "-0X+0X 0X-0x+0x 0x"; |
384 | 384 | |
385 | - if (ldbl < 0) | |
386 | - ldbl = -ldbl; | |
385 | + if (dbl < 0) | |
386 | + dbl = -dbl; | |
387 | 387 | else if (flags & io_info::FLG_SIGN) |
388 | 388 | prefix += 3; |
389 | 389 | else if (flags & io_info::FLG_SPACE) |
@@ -391,17 +391,17 @@ | ||
391 | 391 | else |
392 | 392 | px = 0, ++prefix; |
393 | 393 | |
394 | - ldbl = frexpl (ldbl, &e2); | |
394 | + dbl = frexpl (dbl, &e2); | |
395 | 395 | |
396 | 396 | if (radix == 16) |
397 | 397 | { // Hex-float. |
398 | 398 | int convdig = (flags & io_info::FLG_UPPER) ? 'A' : 'a'; |
399 | - if ((ldbl += ldbl) != 0) | |
399 | + if ((dbl += dbl) != 0) | |
400 | 400 | --e2; |
401 | 401 | |
402 | 402 | if (prec != 0 && prec < (int)((DBL_DIG + 1) * .831) + 1) |
403 | 403 | { // Round the mantissa. |
404 | - double tail = ldbl; | |
404 | + double tail = dbl; | |
405 | 405 | int q; |
406 | 406 | |
407 | 407 | for (q = prec ; ; --q) |
@@ -426,7 +426,7 @@ | ||
426 | 426 | for (q = prec; q > 0; --q) |
427 | 427 | tail *= 0.0625; |
428 | 428 | |
429 | - ldbl += tail; | |
429 | + dbl += tail; | |
430 | 430 | } |
431 | 431 | |
432 | 432 | ix = 0; // Return value. |
@@ -437,22 +437,22 @@ | ||
437 | 437 | ix += strm->putb (interp, '0'); |
438 | 438 | ix += strm->putb (interp, convdig - 'A' + 'X'); |
439 | 439 | |
440 | - int digit = (int)ldbl; | |
441 | - ldbl -= digit; | |
440 | + int digit = (int)dbl; | |
441 | + dbl -= digit; | |
442 | 442 | |
443 | 443 | ix += strm->putb (interp, '0' + digit); |
444 | 444 | |
445 | - if ((flags & io_info::FLG_ALT) || ldbl > 0 || prec > 0) | |
445 | + if ((flags & io_info::FLG_ALT) || dbl > 0 || prec > 0) | |
446 | 446 | { |
447 | 447 | ix += strm->putb (interp, '.'); // XXX: Localization. |
448 | 448 | |
449 | 449 | /* The following loop must terminate, based on the above |
450 | 450 | * assertion that FLT_RADIX is a power of 2. */ |
451 | - for (; ldbl > 0; --prec) | |
451 | + for (; dbl > 0; --prec) | |
452 | 452 | { |
453 | - ldbl *= 16.; | |
454 | - digit = (int)ldbl; | |
455 | - ldbl -= digit; | |
453 | + dbl *= 16.; | |
454 | + digit = (int)dbl; | |
455 | + dbl -= digit; | |
456 | 456 | |
457 | 457 | ix += strm->putb (interp, digit < 0 ? |
458 | 458 | '0' : convdig - 10 + digit); |
@@ -470,9 +470,9 @@ | ||
470 | 470 | return (ix); |
471 | 471 | } |
472 | 472 | |
473 | - if ((ldbl += ldbl) != 0) | |
473 | + if ((dbl += dbl) != 0) | |
474 | 474 | { |
475 | - ldbl *= 0x1p28; | |
475 | + dbl *= 0x1p28; | |
476 | 476 | e2 -= 29; |
477 | 477 | } |
478 | 478 |
@@ -488,10 +488,10 @@ | ||
488 | 488 | |
489 | 489 | do |
490 | 490 | { |
491 | - *zp = (uint32_t)ldbl; | |
492 | - ldbl = 1000000000 * (ldbl - *zp++); | |
491 | + *zp = (uint32_t)dbl; | |
492 | + dbl = 1000000000 * (dbl - *zp++); | |
493 | 493 | } |
494 | - while (ldbl != 0); | |
494 | + while (dbl != 0); | |
495 | 495 | |
496 | 496 | while (e2 > 0) |
497 | 497 | { |