• Home
  • Raw
  • Download

Lines Matching refs:expn

188     r->expn = BF_EXP_ZERO;  in bf_init()
213 r->expn = BF_EXP_ZERO; in bf_set_ui()
227 r->expn = LIMB_BITS - shift; in bf_set_ui()
240 r->expn = 2 * LIMB_BITS - shift; in bf_set_ui()
266 r->expn = BF_EXP_NAN; in bf_set_nan()
273 r->expn = BF_EXP_ZERO; in bf_set_zero()
280 r->expn = BF_EXP_INF; in bf_set_inf()
294 r->expn = a->expn; in bf_set()
473 r->expn = e_max; in bf_set_overflow()
499 prec = r->expn + prec1; in __bf_round()
502 } else if (unlikely(r->expn < e_min) && (flags & BF_FLAG_SUBNORMAL)) { in __bf_round()
506 prec = prec1 - (e_min - r->expn); in __bf_round()
519 r->expn += 1 - prec; in __bf_round()
548 r->expn++; in __bf_round()
553 if (unlikely(r->expn < e_min)) { in __bf_round()
567 if (unlikely(r->expn > e_max)) in __bf_round()
604 r->expn = BF_EXP_ZERO; in bf_normalize_and_round()
608 r->expn -= (r->len - l) * LIMB_BITS; in bf_normalize_and_round()
619 r->expn -= shift; in bf_normalize_and_round()
637 if (a->expn == BF_EXP_INF || a->expn == BF_EXP_NAN) in bf_can_round()
642 if (a->expn == BF_EXP_ZERO) in bf_can_round()
717 if (a->expn == BF_EXP_NAN) { in bf_print_str()
722 if (a->expn == BF_EXP_ZERO) { in bf_print_str()
724 } else if (a->expn == BF_EXP_INF) { in bf_print_str()
730 printf("p%" PRId_LIMB, a->expn); in bf_print_str()
743 if (a->expn != b->expn) { in bf_cmpu()
744 if (a->expn < b->expn) in bf_cmpu()
768 if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { in bf_cmp_full()
769 if (a->expn == b->expn) in bf_cmp_full()
771 else if (a->expn == BF_EXP_NAN) in bf_cmp_full()
792 if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { in bf_cmp()
795 if (a->expn == BF_EXP_ZERO && b->expn == BF_EXP_ZERO) in bf_cmp()
824 a->expn - b->expn; in count_cancelled_bits()
885 if (cmp_res == 0 && is_sub && a->expn < BF_EXP_INF) { in bf_add_internal()
891 if (a->expn >= BF_EXP_INF) { in bf_add_internal()
892 if (a->expn == BF_EXP_NAN) { in bf_add_internal()
895 } else if (b->expn == BF_EXP_INF && is_sub) { in bf_add_internal()
913 r->expn = a->expn; in bf_add_internal()
914 d = a->expn - b->expn; in bf_add_internal()
1001 r->expn += LIMB_BITS; in bf_add_internal()
1537 if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { in bf_mul()
1540 } else if (a->expn == BF_EXP_INF || b->expn == BF_EXP_INF) { in bf_mul()
1541 if ((a->expn == BF_EXP_INF && b->expn == BF_EXP_ZERO) || in bf_mul()
1542 (a->expn == BF_EXP_ZERO && b->expn == BF_EXP_INF)) { in bf_mul()
1596 r->expn = a->expn + b->expn; in bf_mul()
1614 r->expn += e; in bf_mul_2exp()
1630 return a->expn - (a->len - i) * LIMB_BITS + k; in bf_get_exp_min()
1645 bf_div(q, a, b, bf_max(a->expn - b->expn + 1, 2), BF_RNDZ); in bf_tdivremu()
1660 if (a->expn >= BF_EXP_INF || b->expn >= BF_EXP_INF) { in __bf_div()
1661 if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { in __bf_div()
1664 } else if (a->expn == BF_EXP_INF && b->expn == BF_EXP_INF) { in __bf_div()
1667 } else if (a->expn == BF_EXP_INF) { in __bf_div()
1674 } else if (a->expn == BF_EXP_ZERO) { in __bf_div()
1675 if (b->expn == BF_EXP_ZERO) { in __bf_div()
1682 } else if (b->expn == BF_EXP_ZERO) { in __bf_div()
1714 r->expn = a->expn - b->expn + LIMB_BITS; in __bf_div()
1746 if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { in bf_divrem()
1749 } else if (a->expn == BF_EXP_INF || b->expn == BF_EXP_ZERO) { in bf_divrem()
1781 a1->expn = a->expn; in bf_divrem()
1786 b1->expn = b->expn; in bf_divrem()
1799 b1->expn--; in bf_divrem()
1801 b1->expn++; in bf_divrem()
1805 get_bit(q->tab, q->len, q->len * LIMB_BITS - q->expn)))) { in bf_divrem()
2078 if (a->expn == BF_EXP_NAN) { in bf_sqrtrem()
2080 } else if (a->expn == BF_EXP_INF && a->sign) { in bf_sqrtrem()
2097 bf_sqrt(r, a, (a->expn + 1) / 2, BF_RNDZ); in bf_sqrtrem()
2134 if (a->expn == BF_EXP_NAN) { in bf_sqrt()
2136 } else if (a->expn == BF_EXP_INF && a->sign) { in bf_sqrt()
2162 if (a->expn & 1) { in bf_sqrt()
2181 r->expn = (a->expn + 1) >> 1; in bf_sqrt()
2332 if (a1->expn <= 0) in bf_logic_op()
2337 if (b1->expn <= 0) in bf_logic_op()
2366 l = bf_min(a->expn, b->expn); in bf_logic_op()
2368 l = a->expn; in bf_logic_op()
2370 l = b->expn; in bf_logic_op()
2372 l = bf_max(a->expn, b->expn); in bf_logic_op()
2378 a_bit_offset = a->len * LIMB_BITS - a->expn; in bf_logic_op()
2379 b_bit_offset = b->len * LIMB_BITS - b->expn; in bf_logic_op()
2388 r->expn = l * LIMB_BITS; in bf_logic_op()
2440 if (a->expn == BF_EXP_NAN) { in bf_get_float64()
2450 if (b->expn == BF_EXP_INF) { in bf_get_float64()
2453 } else if (b->expn == BF_EXP_ZERO) { in bf_get_float64()
2457 e = b->expn + 1023 - 1; in bf_get_float64()
2512 a->expn = e - 1023 + 1; in bf_set_float64()
2537 if (a->expn >= BF_EXP_INF) { in bf_get_int32()
2541 } else if (a->expn == BF_EXP_INF) { in bf_get_int32()
2546 } else if (a->expn <= 0) { in bf_get_int32()
2549 } else if (a->expn <= 31) { in bf_get_int32()
2550 v = a->tab[a->len - 1] >> (LIMB_BITS - a->expn); in bf_get_int32()
2558 if (a->expn == 32 && in bf_get_int32()
2566 v = get_bits(a->tab, a->len, a->len * LIMB_BITS - a->expn); in bf_get_int32()
2581 if (a->expn >= BF_EXP_INF) { in bf_get_int64()
2585 } else if (a->expn == BF_EXP_INF) { in bf_get_int64()
2590 } else if (a->expn <= 0) { in bf_get_int64()
2593 } else if (a->expn <= 63) { in bf_get_int64()
2595 if (a->expn <= 32) in bf_get_int64()
2596 v = a->tab[a->len - 1] >> (LIMB_BITS - a->expn); in bf_get_int64()
2599 get_limbz(a, a->len - 2)) >> (64 - a->expn); in bf_get_int64()
2601 v = a->tab[a->len - 1] >> (LIMB_BITS - a->expn); in bf_get_int64()
2611 if (a->expn == 64) { in bf_get_int64()
2623 slimb_t bit_pos = a->len * LIMB_BITS - a->expn; in bf_get_int64()
2642 if (a->expn == BF_EXP_NAN) { in bf_get_uint64()
2644 } else if (a->expn <= 0) { in bf_get_uint64()
2650 } else if (a->expn <= 64) { in bf_get_uint64()
2652 if (a->expn <= 32) in bf_get_uint64()
2653 v = a->tab[a->len - 1] >> (LIMB_BITS - a->expn); in bf_get_uint64()
2656 get_limbz(a, a->len - 2)) >> (64 - a->expn); in bf_get_uint64()
2658 v = a->tab[a->len - 1] >> (LIMB_BITS - a->expn); in bf_get_uint64()
2757 slimb_t expn, limb_t prec, bf_flags_t flags) in bf_mul_pow_radix() argument
2765 } else if (expn == 0) { in bf_mul_pow_radix()
2771 e = expn; in bf_mul_pow_radix()
2885 slimb_t pos, expn, int_len, digit_count; in bf_atof_internal() local
3046 expn = 0; in bf_atof_internal()
3066 if (unlikely(expn > ((BF_RAW_EXP_MAX - 2 - 9) / 10))) { in bf_atof_internal()
3078 expn = expn * 10 + c; in bf_atof_internal()
3081 expn = -expn; in bf_atof_internal()
3084 a->expn = expn + int_len; in bf_atof_internal()
3090 expn *= radix_bits; in bf_atof_internal()
3091 a->expn = expn + (int_len * radix_bits); in bf_atof_internal()
3104 expn -= l * digits_per_limb - int_len; in bf_atof_internal()
3113 *pexponent = expn; in bf_atof_internal()
3116 ret = bf_mul_pow_radix(r, T, radix, expn, prec, flags); in bf_atof_internal()
3383 out[0] = get_bits(a->tab, a->len, a->len * LIMB_BITS - a->expn); in bf_integer_to_radix_rec()
3387 pos = a->len * LIMB_BITS - a->expn; in bf_integer_to_radix_rec()
3506 E = 1 + bf_mul_log2_radix(a->expn - 1, radix, TRUE, FALSE); in bf_convert_to_radix()
3538 !bf_can_round(r, r->expn, rnd_mode, prec)) { in bf_convert_to_radix()
3638 pos = a->len * LIMB_BITS + smod(-a->expn, radix_bits); in output_digits()
3710 if (a2->expn == BF_EXP_NAN) { in bf_ftoa_internal()
3715 if (a2->expn == BF_EXP_INF) { in bf_ftoa_internal()
3740 n = a1->expn; in bf_ftoa_internal()
3746 n = ceil_div(a1->expn, radix_bits); in bf_ftoa_internal()
3756 if (a1->expn == BF_EXP_ZERO) { in bf_ftoa_internal()
3786 a->expn = a2->expn; in bf_ftoa_internal()
3790 n = 1 + bf_mul_log2_radix(bf_max(a->expn, 0), radix, TRUE, TRUE); in bf_ftoa_internal()
3828 n = a1->expn; in bf_ftoa_internal()
3840 smod(-a1->expn, radix_bits); in bf_ftoa_internal()
3850 smod(-a1->expn, radix_bits); in bf_ftoa_internal()
3860 n = ceil_div(a1->expn, radix_bits); in bf_ftoa_internal()
3867 a->expn = a2->expn; in bf_ftoa_internal()
3924 if (a1->expn == BF_EXP_ZERO && in bf_ftoa_internal()
3938 if (a1->expn == BF_EXP_ZERO) in bf_ftoa_internal()
4016 Q->expn += 2; in bf_const_log2_rec()
4272 T->expn += e; in bf_add_epsilon()
4292 if (a->expn <= -1) { in bf_exp_internal()
4308 if (a->expn > 0) in bf_exp_internal()
4309 prec1 += a->expn; in bf_exp_internal()
4358 if (a_high->expn <= 0) in check_exp_underflow_overflow()
4389 r->expn = e_min; in check_exp_underflow_overflow()
4406 if (a->expn == BF_EXP_NAN) { in bf_exp()
4408 } else if (a->expn == BF_EXP_INF) { in bf_exp()
4422 if (a->expn < 0 && (-a->expn) >= (prec + 2)) { in bf_exp()
4447 n = T->expn; in bf_log_internal()
4448 T->expn = 0; in bf_log_internal()
4452 U->expn = 0; in bf_log_internal()
4454 T->expn++; in bf_log_internal()
4537 if (a->expn == BF_EXP_NAN) { in bf_log()
4540 } else if (a->expn == BF_EXP_INF) { in bf_log()
4638 v = get_bits(x->tab, x->len, x->len * LIMB_BITS - x->expn + e); in check_exact_power2n()
4644 T->expn -= e; in check_exact_power2n()
4651 r->expn += er; in check_exact_power2n()
4666 if (y->expn == BF_EXP_ZERO) { in bf_pow()
4669 } else if (x->expn == BF_EXP_NAN) { in bf_pow()
4676 (y->expn >= BF_EXP_INF)) { in bf_pow()
4679 (!x->sign || y->expn != BF_EXP_NAN)) { in bf_pow()
4682 } else if (y->expn == BF_EXP_NAN) { in bf_pow()
4684 } else if (y->expn == BF_EXP_INF) { in bf_pow()
4693 if (y->sign == (x->expn == BF_EXP_ZERO)) { in bf_pow()
4758 T_bits = T->expn - bf_get_exp_min(T); in bf_pow()
4761 bf_mul_si(T, y, T->expn - 1, LIMB_BITS, BF_RNDZ); in bf_pow()
4777 if (y->expn <= 31) { in bf_pow()
4811 y1->expn = y->expn - y_emin; in bf_pow()
4862 if (a->expn <= -1) { in bf_sincos()
4870 prec2 = prec1 + a->expn + cancel; in bf_sincos()
4875 if (mod == 0 || (T->expn != BF_EXP_ZERO && in bf_sincos()
4876 (T->expn + prec2) >= (prec1 - 1))) in bf_sincos()
4879 cancel = bf_max(-T->expn, (cancel + 1) * 3 / 2); in bf_sincos()
4946 if (a->expn == BF_EXP_NAN) { in bf_cos()
4949 } else if (a->expn == BF_EXP_INF) { in bf_cos()
4960 if (a->expn < 0) { in bf_cos()
4962 e = 2 * a->expn - 1; in bf_cos()
4980 if (a->expn == BF_EXP_NAN) { in bf_sin()
4983 } else if (a->expn == BF_EXP_INF) { in bf_sin()
4994 if (a->expn < 0) { in bf_sin()
4996 e = sat_add(2 * a->expn, a->expn - 2); in bf_sin()
4997 if (e < a->expn - bf_max(prec + 2, a->len * LIMB_BITS + 2)) { in bf_sin()
5025 if (a->expn == BF_EXP_NAN) { in bf_tan()
5028 } else if (a->expn == BF_EXP_INF) { in bf_tan()
5039 if (a->expn < 0) { in bf_tan()
5041 e = sat_add(2 * a->expn, a->expn - 1); in bf_tan()
5042 if (e < a->expn - bf_max(prec + 2, a->len * LIMB_BITS + 2)) { in bf_tan()
5072 cmp_1 = (a->expn >= 1); /* a >= 1 */ in bf_atan_internal()
5146 if (a->expn == BF_EXP_NAN) { in bf_atan()
5149 } else if (a->expn == BF_EXP_INF) { in bf_atan()
5173 if (a->expn < 0) { in bf_atan()
5175 e = sat_add(2 * a->expn, a->expn - 1); in bf_atan()
5176 if (e < a->expn - bf_max(prec + 2, a->len * LIMB_BITS + 2)) { in bf_atan()
5193 if (y->expn == BF_EXP_NAN || x->expn == BF_EXP_NAN) { in bf_atan2_internal()
5201 if (y->expn == BF_EXP_INF && x->expn == BF_EXP_INF) { in bf_atan2_internal()
5204 } else if (y->expn == BF_EXP_ZERO && x->expn == BF_EXP_ZERO) { in bf_atan2_internal()
5242 if (a->expn >= 0) in bf_asin_internal()
5267 if (a->expn == BF_EXP_NAN) { in bf_asin()
5270 } else if (a->expn == BF_EXP_INF) { in bf_asin()
5289 if (a->expn < 0) { in bf_asin()
5291 e = sat_add(2 * a->expn, a->expn - 2); in bf_asin()
5292 if (e < a->expn - bf_max(prec + 2, a->len * LIMB_BITS + 2)) { in bf_asin()
5308 if (a->expn == BF_EXP_NAN) { in bf_acos()
5311 } else if (a->expn == BF_EXP_INF) { in bf_acos()
6275 if (a->expn == BF_EXP_NAN) { in bfdec_print_str()
6280 if (a->expn == BF_EXP_ZERO) { in bfdec_print_str()
6282 } else if (a->expn == BF_EXP_INF) { in bfdec_print_str()
6288 printf("e%" PRId_LIMB, a->expn); in bfdec_print_str()
6432 prec = r->expn + prec1; in __bfdec_round()
6435 } else if (unlikely(r->expn < e_min) && (flags & BF_FLAG_SUBNORMAL)) { in __bfdec_round()
6439 prec = prec1 - (e_min - r->expn); in __bfdec_round()
6453 r->expn += 1 - prec; in __bfdec_round()
6470 r->expn++; in __bfdec_round()
6475 if (unlikely(r->expn < e_min)) { in __bfdec_round()
6489 if (unlikely(r->expn > e_max)) { in __bfdec_round()
6538 r->expn = BF_EXP_ZERO; in bfdec_normalize_and_round()
6542 r->expn -= (r->len - l) * LIMB_DIGITS; in bfdec_normalize_and_round()
6548 r->expn -= shift; in bfdec_normalize_and_round()
6566 r->expn = 3 * LIMB_DIGITS; in bfdec_set_ui()
6574 r->expn = 2 * LIMB_DIGITS; in bfdec_set_ui()
6579 r->expn = LIMB_DIGITS; in bfdec_set_ui()
6617 if (cmp_res == 0 && is_sub && a->expn < BF_EXP_INF) { in bfdec_add_internal()
6623 if (a->expn >= BF_EXP_INF) { in bfdec_add_internal()
6624 if (a->expn == BF_EXP_NAN) { in bfdec_add_internal()
6628 } else if (b->expn == BF_EXP_INF && is_sub) { in bfdec_add_internal()
6649 d = a->expn - b->expn; in bfdec_add_internal()
6657 r->expn = a->expn; in bfdec_add_internal()
6701 r->expn += LIMB_DIGITS; in bfdec_add_internal()
6754 if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { in bfdec_mul()
6757 } else if (a->expn == BF_EXP_INF || b->expn == BF_EXP_INF) { in bfdec_mul()
6758 if ((a->expn == BF_EXP_INF && b->expn == BF_EXP_ZERO) || in bfdec_mul()
6759 (a->expn == BF_EXP_ZERO && b->expn == BF_EXP_INF)) { in bfdec_mul()
6792 r->expn = a->expn + b->expn; in bfdec_mul()
6833 if (a->expn >= BF_EXP_INF || b->expn >= BF_EXP_INF) { in __bfdec_div()
6834 if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { in __bfdec_div()
6837 } else if (a->expn == BF_EXP_INF && b->expn == BF_EXP_INF) { in __bfdec_div()
6840 } else if (a->expn == BF_EXP_INF) { in __bfdec_div()
6847 } else if (a->expn == BF_EXP_ZERO) { in __bfdec_div()
6848 if (b->expn == BF_EXP_ZERO) { in __bfdec_div()
6855 } else if (b->expn == BF_EXP_ZERO) { in __bfdec_div()
6869 precl = (bf_max(a->expn - b->expn, 0) + 2 + in __bfdec_div()
6909 r->expn = a->expn - b->expn + LIMB_DIGITS; in __bfdec_div()
6965 if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { in bfdec_divrem()
6968 } else if (a->expn == BF_EXP_INF || b->expn == BF_EXP_ZERO) { in bfdec_divrem()
7000 a1->expn = a->expn; in bfdec_divrem()
7005 b1->expn = b->expn; in bfdec_divrem()
7033 (get_digit(q->tab, q->len, q->len * LIMB_DIGITS - q->expn) & 1) != 0))) { in bfdec_divrem()
7083 if (a->expn == BF_EXP_NAN) { in bfdec_sqrt()
7085 } else if (a->expn == BF_EXP_INF && a->sign) { in bfdec_sqrt()
7097 prec1 = bf_max(floor_div(a->expn + 1, 2) + prec, 1); in bfdec_sqrt()
7112 if (a->expn & 1) { in bfdec_sqrt()
7145 r->expn = (a->expn + 1) >> 1; in bfdec_sqrt()
7160 if (a->expn >= BF_EXP_INF) { in bfdec_get_int32()
7162 if (a->expn == BF_EXP_INF) { in bfdec_get_int32()
7168 } else if (a->expn <= 0) { in bfdec_get_int32()
7171 } else if (a->expn <= 9) { in bfdec_get_int32()
7172 v = fast_shr_dec(a->tab[a->len - 1], LIMB_DIGITS - a->expn); in bfdec_get_int32()
7176 } else if (a->expn == 10) { in bfdec_get_int32()
7180 v1 = fast_shr_dec(a->tab[a->len - 1], LIMB_DIGITS - a->expn); in bfdec_get_int32()