Changeset 09da99 in git for ntl/src/xdouble.c
- Timestamp:
- Nov 3, 2003, 6:33:49 PM (21 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b9f50b373314e74e83c7c060a651dd2913e1f033')
- Children:
- 70fea801cbe08a22d1b0e9d8d1d410144e0e91f6
- Parents:
- be2bb37dcbd03b120f14559d378b21b104d907c4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ntl/src/xdouble.c
rbe2bb3 r09da99 16 16 if (p < 1) p = 1; 17 17 18 if ( p >= (1L << (NTL_BITS_PER_LONG-4)))18 if (NTL_OVERFLOW(p, 1, 0)) 19 19 Error("xdouble: output precision too big"); 20 20 … … 35 35 } 36 36 37 if (e >= (1L << (NTL_BITS_PER_LONG-4)))37 if (e >= NTL_OVFBND) 38 38 Error("xdouble: overflow"); 39 39 40 if (e <= - (1L << (NTL_BITS_PER_LONG-4)))40 if (e <= -NTL_OVFBND) 41 41 Error("xdouble: underflow"); 42 42 } … … 391 391 } 392 392 393 if (q >= (1L << (NTL_BITS_PER_LONG-4)))393 if (q >= NTL_OVFBND) 394 394 Error("xdouble: overflow"); 395 395 396 if (q <= - (1L << (NTL_BITS_PER_LONG-4)))396 if (q <= -NTL_OVFBND) 397 397 Error("xdouble: underflow"); 398 398 399 int rr = r; 400 double x = ldexp(1.0, rr); 399 double x = _ntl_ldexp(1.0, r); 401 400 402 401 z.x = x; … … 530 529 double iy = floor(y+0.5); 531 530 532 if (iy >= (1L << (NTL_BITS_PER_LONG-4)))531 if (iy >= NTL_OVFBND) 533 532 Error("xdouble: overflow"); 534 533 535 if (iy <= - (1L << (NTL_BITS_PER_LONG-4)))534 if (iy <= -NTL_OVFBND) 536 535 Error("xdouble: underflow"); 537 536 … … 561 560 ComputeLn10(ln10); 562 561 563 long k = to_long( to_RR( 1L << (NTL_BITS_PER_LONG-5)) * ln2 / ln10 );562 long k = to_long( to_RR(NTL_OVFBND/2) * ln2 / ln10 ); 564 563 565 564 RR::SetPrecision(old_p); … … 614 613 615 614 616 617 618 615 xdouble to_xdouble(const char *s) 619 616 { 620 617 long c; 618 long cval; 621 619 long sign; 622 620 ZZ a, b; … … 626 624 627 625 c = s[i]; 628 while ( c == ' ' || c == '\n' || c == '\t') {626 while (IsWhiteSpace(c)) { 629 627 i++; 630 628 c = s[i]; … … 646 644 b = 1; 647 645 648 if (c >= '0' && c <= '9') { 646 cval = CharToIntVal(c); 647 648 if (cval >= 0 && cval <= 9) { 649 649 got1 = 1; 650 650 651 while (c >= '0' && c <= '9') {651 while (cval >= 0 && cval <= 9) { 652 652 mul(a, a, 10); 653 add(a, a, c -'0');653 add(a, a, cval); 654 654 i++; 655 655 c = s[i]; 656 cval = CharToIntVal(c); 656 657 } 657 658 } … … 662 663 i++; 663 664 c = s[i]; 664 665 if (c >= '0' && c <= '9') { 665 cval = CharToIntVal(c); 666 667 if (cval >= 0 && cval <= 9) { 666 668 got2 = 1; 667 669 668 while (c >= '0' && c <= '9') {670 while (cval >= 0 && cval <= 9) { 669 671 mul(a, a, 10); 670 add(a, a, c -'0');672 add(a, a, cval); 671 673 mul(b, b, 10); 672 674 i++; 673 675 c = s[i]; 676 cval = CharToIntVal(c); 674 677 } 675 678 } … … 702 705 e_sign = 1; 703 706 704 if (c < '0' || c > '9') Error("bad xdouble input"); 707 cval = CharToIntVal(c); 708 709 if (cval < 0 || cval > 9) Error("bad xdouble input"); 705 710 706 711 e = 0; 707 while (c >= '0' && c <= '9') {712 while (cval >= 0 && cval <= 9) { 708 713 mul(e, e, 10); 709 add(e, e, c -'0');714 add(e, e, cval); 710 715 i++; 711 716 c = s[i]; 717 cval = CharToIntVal(c); 712 718 } 713 719 }
Note: See TracChangeset
for help on using the changeset viewer.