|
Lines 698-824
irintl(long double x)
Link Here
|
| 698 |
#endif |
698 |
#endif |
| 699 |
#endif |
699 |
#endif |
| 700 |
|
700 |
|
| 701 |
/* Write a pari script to test things externally. */ |
|
|
| 702 |
#ifdef DOPRINT |
| 703 |
#include <stdio.h> |
| 704 |
|
| 705 |
#ifndef DOPRINT_SWIZZLE |
| 706 |
#define DOPRINT_SWIZZLE 0 |
| 707 |
#endif |
| 708 |
|
| 709 |
#ifdef DOPRINT_LD80 |
| 710 |
|
| 711 |
#define DOPRINT_START(xp) do { \ |
| 712 |
uint64_t __lx; \ |
| 713 |
uint16_t __hx; \ |
| 714 |
\ |
| 715 |
/* Hack to give more-problematic args. */ \ |
| 716 |
EXTRACT_LDBL80_WORDS(__hx, __lx, *xp); \ |
| 717 |
__lx ^= DOPRINT_SWIZZLE; \ |
| 718 |
INSERT_LDBL80_WORDS(*xp, __hx, __lx); \ |
| 719 |
printf("x = %.21Lg; ", (long double)*xp); \ |
| 720 |
} while (0) |
| 721 |
#define DOPRINT_END1(v) \ |
| 722 |
printf("y = %.21Lg; z = 0; show(x, y, z);\n", (long double)(v)) |
| 723 |
#define DOPRINT_END2(hi, lo) \ |
| 724 |
printf("y = %.21Lg; z = %.21Lg; show(x, y, z);\n", \ |
| 725 |
(long double)(hi), (long double)(lo)) |
| 726 |
|
| 727 |
#elif defined(DOPRINT_D64) |
| 728 |
|
| 729 |
#define DOPRINT_START(xp) do { \ |
| 730 |
uint32_t __hx, __lx; \ |
| 731 |
\ |
| 732 |
EXTRACT_WORDS(__hx, __lx, *xp); \ |
| 733 |
__lx ^= DOPRINT_SWIZZLE; \ |
| 734 |
INSERT_WORDS(*xp, __hx, __lx); \ |
| 735 |
printf("x = %.21Lg; ", (long double)*xp); \ |
| 736 |
} while (0) |
| 737 |
#define DOPRINT_END1(v) \ |
| 738 |
printf("y = %.21Lg; z = 0; show(x, y, z);\n", (long double)(v)) |
| 739 |
#define DOPRINT_END2(hi, lo) \ |
| 740 |
printf("y = %.21Lg; z = %.21Lg; show(x, y, z);\n", \ |
| 741 |
(long double)(hi), (long double)(lo)) |
| 742 |
|
| 743 |
#elif defined(DOPRINT_F32) |
| 744 |
|
| 745 |
#define DOPRINT_START(xp) do { \ |
| 746 |
uint32_t __hx; \ |
| 747 |
\ |
| 748 |
GET_FLOAT_WORD(__hx, *xp); \ |
| 749 |
__hx ^= DOPRINT_SWIZZLE; \ |
| 750 |
SET_FLOAT_WORD(*xp, __hx); \ |
| 751 |
printf("x = %.21Lg; ", (long double)*xp); \ |
| 752 |
} while (0) |
| 753 |
#define DOPRINT_END1(v) \ |
| 754 |
printf("y = %.21Lg; z = 0; show(x, y, z);\n", (long double)(v)) |
| 755 |
#define DOPRINT_END2(hi, lo) \ |
| 756 |
printf("y = %.21Lg; z = %.21Lg; show(x, y, z);\n", \ |
| 757 |
(long double)(hi), (long double)(lo)) |
| 758 |
|
| 759 |
#else /* !DOPRINT_LD80 && !DOPRINT_D64 (LD128 only) */ |
| 760 |
|
| 761 |
#ifndef DOPRINT_SWIZZLE_HIGH |
| 762 |
#define DOPRINT_SWIZZLE_HIGH 0 |
| 763 |
#endif |
| 764 |
|
| 765 |
#define DOPRINT_START(xp) do { \ |
| 766 |
uint64_t __lx, __llx; \ |
| 767 |
uint16_t __hx; \ |
| 768 |
\ |
| 769 |
EXTRACT_LDBL128_WORDS(__hx, __lx, __llx, *xp); \ |
| 770 |
__llx ^= DOPRINT_SWIZZLE; \ |
| 771 |
__lx ^= DOPRINT_SWIZZLE_HIGH; \ |
| 772 |
INSERT_LDBL128_WORDS(*xp, __hx, __lx, __llx); \ |
| 773 |
printf("x = %.36Lg; ", (long double)*xp); \ |
| 774 |
} while (0) |
| 775 |
#define DOPRINT_END1(v) \ |
| 776 |
printf("y = %.36Lg; z = 0; show(x, y, z);\n", (long double)(v)) |
| 777 |
#define DOPRINT_END2(hi, lo) \ |
| 778 |
printf("y = %.36Lg; z = %.36Lg; show(x, y, z);\n", \ |
| 779 |
(long double)(hi), (long double)(lo)) |
| 780 |
|
| 781 |
#endif /* DOPRINT_LD80 */ |
| 782 |
|
| 783 |
#else /* !DOPRINT */ |
| 784 |
#define DOPRINT_START(xp) |
| 785 |
#define DOPRINT_END1(v) |
| 786 |
#define DOPRINT_END2(hi, lo) |
| 787 |
#endif /* DOPRINT */ |
| 788 |
|
| 789 |
#define RETURNP(x) do { \ |
| 790 |
DOPRINT_END1(x); \ |
| 791 |
RETURNF(x); \ |
| 792 |
} while (0) |
| 793 |
#define RETURNPI(x) do { \ |
| 794 |
DOPRINT_END1(x); \ |
| 795 |
RETURNI(x); \ |
| 796 |
} while (0) |
| 797 |
#define RETURN2P(x, y) do { \ |
| 798 |
DOPRINT_END2((x), (y)); \ |
| 799 |
RETURNF((x) + (y)); \ |
| 800 |
} while (0) |
| 801 |
#define RETURN2PI(x, y) do { \ |
| 802 |
DOPRINT_END2((x), (y)); \ |
| 803 |
RETURNI((x) + (y)); \ |
| 804 |
} while (0) |
| 805 |
#ifdef STRUCT_RETURN |
701 |
#ifdef STRUCT_RETURN |
| 806 |
#define RETURNSP(rp) do { \ |
702 |
#define RETURNSP(rp) do { \ |
| 807 |
if (!(rp)->lo_set) \ |
703 |
if (!(rp)->lo_set) \ |
| 808 |
RETURNP((rp)->hi); \ |
704 |
RETURNF((rp)->hi); \ |
| 809 |
RETURN2P((rp)->hi, (rp)->lo); \ |
705 |
RETURNF((rp)->hi + (rp)->lo); \ |
| 810 |
} while (0) |
706 |
} while (0) |
| 811 |
#define RETURNSPI(rp) do { \ |
707 |
#define RETURNSPI(rp) do { \ |
| 812 |
if (!(rp)->lo_set) \ |
708 |
if (!(rp)->lo_set) \ |
| 813 |
RETURNPI((rp)->hi); \ |
709 |
RETURNI((rp)->hi); \ |
| 814 |
RETURN2PI((rp)->hi, (rp)->lo); \ |
710 |
RETURNI((rp)->hi + (rp)->lo); \ |
| 815 |
} while (0) |
711 |
} while (0) |
| 816 |
#endif |
712 |
#endif |
|
|
713 |
|
| 817 |
#define SUM2P(x, y) ({ \ |
714 |
#define SUM2P(x, y) ({ \ |
| 818 |
const __typeof (x) __x = (x); \ |
715 |
const __typeof (x) __x = (x); \ |
| 819 |
const __typeof (y) __y = (y); \ |
716 |
const __typeof (y) __y = (y); \ |
| 820 |
\ |
|
|
| 821 |
DOPRINT_END2(__x, __y); \ |
| 822 |
__x + __y; \ |
717 |
__x + __y; \ |
| 823 |
}) |
718 |
}) |
| 824 |
|
719 |
|