33#define MP_NUMER_SIGN(Q) (MP_NUMER_P(Q)->sign)
34#define MP_DENOM_SIGN(Q) (MP_DENOM_P(Q)->sign)
36#define TEMP(K) (temp + (K))
39 if ((res = (E)) != MP_OK) goto CLEANUP; \
65 mp_rat out = malloc(
sizeof(*out));
249 if (c ==
a || c ==
b) {
410 int cmp = INT_MAX, last = 0;
424 while (--last >= 0) {
483 int len = strlen(
str);
484 char *start =
str + len;
515 int zprec = (int)prec;
526 if (zprec > lead_0) {
601 int len = strlen(start);
605 if (prec == 0)
goto CLEANUP;
610 if (left < zprec + 1) {
615 memset(start,
'0', lead_0 - 1);
640 return n_len + d_len;
650 f_len = 1 + prec + 1;
653 return z_len + f_len;
671 while (isspace((
unsigned char)*endp)) {
678 if (end != NULL) *end = endp;
706 if (radix == 0) radix = 10;
712 if (end != NULL) *end = endp;
726 while (isspace((
unsigned char)*
str)) ++
str;
745 if (end != NULL) *end = endp;
760 if (end != NULL) *end = endp;
762 }
else if (isspace((
unsigned char)*endp) || *endp ==
'-' || *endp ==
'+') {
793 while (save[num_lz] ==
'0') {
841 if (end != NULL) *end = endp;
928 while (--last >= 0) {
void GMPZAPI() gcd(mp_int rop, mp_int op1, mp_int op2)
int GMPQAPI() cmp(mp_rat op1, mp_rat op2)
static mp_result s_rat_reduce(mp_rat r)
static mp_result s_rat_combine(mp_rat a, mp_rat b, mp_rat c, mp_result(*comb_f)(mp_int, mp_int, mp_int))
mp_rat mp_rat_alloc(void)
Allocates a fresh zero-valued mpq_t on the heap, returning NULL in case of error.
static mp_int MP_DENOM_P(mp_rat Q)
static mp_int MP_NUMER_P(mp_rat Q)
#define mp_int_divisible_value
#define mp_rat_is_integer
#define mp_int_read_cstring
#define mp_rat_string_len
#define mp_rat_compare_zero
#define mp_rat_read_string
#define mp_int_compare_zero
#define mp_rat_to_decimal
#define mp_rat_set_uvalue
#define mp_int_string_len
#define mp_rat_read_cdecimal
#define mp_int_compare_unsigned
#define mp_rat_read_ustring
#define mp_int_expt_value
#define mp_rat_read_decimal
#define mp_rat_compare_value
#define mp_rat_compare_unsigned
#define mp_int_set_uvalue
#define mp_int_compare_value
#define mp_rat_read_cstring
#define mp_rat_decimal_len