32 mpz_init_set_str(
mask,
"FFFFFFFFFFFFFFFF", 16);
35 mpz_init_set_str(
mask,
"00000000FFFFFFFF", 16);
38 mpz_init_set_str(
mask,
"000000000000FFFF", 16);
41 mpz_init_set_str(
mask,
"00000000000000FF", 16);
44 mpz_init_set_si(
mask, -1);
47 mpfr_get_z(
a,
r->mf, MPFR_DEFAULT_RND);
49 mpfr_set_z(
r->mf,
a, MPFR_DEFAULT_RND);
62 mpfr_set_ui(mult, 180, MPFR_DEFAULT_RND);
63 mpfr_const_pi(divs, MPFR_DEFAULT_RND);
66 mpfr_set_ui(mult, 1, MPFR_DEFAULT_RND);
67 mpfr_set_ui(divs, 1, MPFR_DEFAULT_RND);
70 mpfr_set_ui(mult, 200, MPFR_DEFAULT_RND);
71 mpfr_const_pi(divs, MPFR_DEFAULT_RND);
74 mpfr_mul(
r->mf,
r->mf, mult, MPFR_DEFAULT_RND);
75 mpfr_div(
r->mf,
r->mf, divs, MPFR_DEFAULT_RND);
85 if (!mpfr_number_p(
r->mf)) {
93 mpfr_const_pi(mult, MPFR_DEFAULT_RND);
94 mpfr_set_ui(divs, 180, MPFR_DEFAULT_RND);
97 mpfr_set_ui(mult, 1, MPFR_DEFAULT_RND);
98 mpfr_set_ui(divs, 1, MPFR_DEFAULT_RND);
101 mpfr_const_pi(mult, MPFR_DEFAULT_RND);
102 mpfr_set_ui(divs, 200, MPFR_DEFAULT_RND);
105 mpfr_mul(
r->mf,
r->mf, mult, MPFR_DEFAULT_RND);
106 mpfr_div(
r->mf,
r->mf, divs, MPFR_DEFAULT_RND);
120 mpfr_init(*mp_3_pi_2);
122 mpfr_const_pi(*mp_pi, MPFR_DEFAULT_RND);
123 mpfr_div_ui(*mp_pi_2, *mp_pi, 2, MPFR_DEFAULT_RND);
124 mpfr_mul_ui(*mp_3_pi_2, *mp_pi, 3, MPFR_DEFAULT_RND);
125 mpfr_div_ui(*mp_3_pi_2, *mp_3_pi_2, 2, MPFR_DEFAULT_RND);
126 mpfr_mul_ui(*mp_2_pi, *mp_pi, 2, MPFR_DEFAULT_RND);
131 mpfr_t mp_pi, mp_pi_2, mp_3_pi_2, mp_2_pi;
136 if (
rpn_is_zero(
c) || !mpfr_cmp(
c->mf, mp_pi) || !mpfr_cmp(
c->mf, mp_2_pi))
139 if (!mpfr_cmp(
c->mf, mp_3_pi_2))
140 mpfr_set_si(
c->mf, -1, MPFR_DEFAULT_RND);
142 if (!mpfr_cmp(
c->mf, mp_pi_2))
143 mpfr_set_si(
c->mf, 1, MPFR_DEFAULT_RND);
145 mpfr_sin(
c->mf,
c->mf, MPFR_DEFAULT_RND);
150 mpfr_clear(mp_3_pi_2);
155 mpfr_t mp_pi, mp_pi_2, mp_3_pi_2, mp_2_pi;
160 if (!mpfr_cmp(
c->mf, mp_pi_2) || !mpfr_cmp(
c->mf, mp_3_pi_2))
163 if (!mpfr_cmp(
c->mf, mp_pi))
164 mpfr_set_si(
c->mf, -1, MPFR_DEFAULT_RND);
166 if (!mpfr_cmp(
c->mf, mp_2_pi))
167 mpfr_set_si(
c->mf, 1, MPFR_DEFAULT_RND);
169 mpfr_cos(
c->mf,
c->mf, MPFR_DEFAULT_RND);
174 mpfr_clear(mp_3_pi_2);
179 mpfr_t mp_pi, mp_pi_2, mp_3_pi_2, mp_2_pi;
184 if (!mpfr_cmp(
c->mf, mp_pi_2) || !mpfr_cmp(
c->mf, mp_3_pi_2))
187 if (!mpfr_cmp(
c->mf, mp_pi) || !mpfr_cmp(
c->mf, mp_2_pi))
190 mpfr_tan(
c->mf,
c->mf, MPFR_DEFAULT_RND);
195 mpfr_clear(mp_3_pi_2);
201 mpfr_asin(
c->mf,
c->mf, MPFR_DEFAULT_RND);
206 mpfr_acos(
c->mf,
c->mf, MPFR_DEFAULT_RND);
211 mpfr_atan(
c->mf,
c->mf, MPFR_DEFAULT_RND);
217 mpfr_sinh(
c->mf,
c->mf, MPFR_DEFAULT_RND);
222 mpfr_cosh(
c->mf,
c->mf, MPFR_DEFAULT_RND);
227 mpfr_tanh(
c->mf,
c->mf, MPFR_DEFAULT_RND);
233 mpfr_asinh(
c->mf,
c->mf, MPFR_DEFAULT_RND);
238 mpfr_acosh(
c->mf,
c->mf, MPFR_DEFAULT_RND);
243 mpfr_atanh(
c->mf,
c->mf, MPFR_DEFAULT_RND);
249 mpfr_trunc(
c->mf,
c->mf);
254 mpfr_frac(
c->mf,
c->mf, MPFR_DEFAULT_RND);
259 if (mpfr_sgn(
c->mf) == 0)
262 mpfr_ui_div(
c->mf, 1,
c->mf, MPFR_DEFAULT_RND);
267 if (mpfr_sgn(
c->mf) < 0) {
272 mpfr_trunc(
c->mf,
c->mf);
273 if (mpfr_fits_ulong_p(
c->mf, MPFR_DEFAULT_RND) == 0)
276 mpfr_fac_ui(
c->mf, mpfr_get_ui(
c->mf, MPFR_DEFAULT_RND), MPFR_DEFAULT_RND);
286 mpfr_get_z(
a,
c->mf, MPFR_DEFAULT_RND);
288 mpfr_set_z(
c->mf,
a, MPFR_DEFAULT_RND);
294 mpfr_const_pi(
c->mf, MPFR_DEFAULT_RND);
299 mpfr_const_pi(
c->mf, MPFR_DEFAULT_RND);
300 mpfr_mul_ui(
c->mf,
c->mf, 2, MPFR_DEFAULT_RND);
305 mpfr_mul_si(
c->mf,
c->mf, -1, MPFR_DEFAULT_RND);
310 mpfr_sqr(
c->mf,
c->mf, MPFR_DEFAULT_RND);
316 mpfr_pow_ui(
c->mf,
c->mf, 3, MPFR_DEFAULT_RND);
322 mpfr_sqrt(
c->mf,
c->mf, MPFR_DEFAULT_RND);
328 mpfr_cbrt(
c->mf,
c->mf, MPFR_DEFAULT_RND);
334 mpfr_exp(
c->mf,
c->mf, MPFR_DEFAULT_RND);
340 mpfr_exp10(
c->mf,
c->mf, MPFR_DEFAULT_RND);
346 mpfr_log(
c->mf,
c->mf, MPFR_DEFAULT_RND);
352 mpfr_log10(
c->mf,
c->mf, MPFR_DEFAULT_RND);
360 mpfr_set_ui(
sum, 0, MPFR_DEFAULT_RND);
362 mpfr_add(
sum,
sum,
p->num.mf, MPFR_DEFAULT_RND);
373 mpfr_set_ui(
sum, 0, MPFR_DEFAULT_RND);
375 mpfr_mul(
sqr,
p->num.mf,
p->num.mf, MPFR_DEFAULT_RND);
376 mpfr_add(
sum,
sum,
sqr, MPFR_DEFAULT_RND);
390 mpfr_div_ui(
c->mf,
c->mf,
n, MPFR_DEFAULT_RND);
393 mpfr_trunc(
c->mf,
c->mf);
404 mpfr_div_ui(
c->mf,
c->mf,
n, MPFR_DEFAULT_RND);
407 mpfr_trunc(
c->mf,
c->mf);
415 mpfr_trunc(
c->mf,
c->mf);
423 mpfr_trunc(
c->mf,
c->mf);
435 mpfr_set_ui(
c->mf, 0, MPFR_DEFAULT_RND);
440 mpfr_div_ui(
c->mf,
c->mf,
n, MPFR_DEFAULT_RND);
445 mpfr_set_ui(
dev, 0, MPFR_DEFAULT_RND);
448 mpfr_sub(
num,
p->num.mf,
c->mf, MPFR_DEFAULT_RND);
449 mpfr_sqr(
num,
num, MPFR_DEFAULT_RND);
450 mpfr_add(
dev,
dev,
num, MPFR_DEFAULT_RND);
453 mpfr_div_ui(
c->mf,
dev, pop_type ?
n-1 :
n, MPFR_DEFAULT_RND);
454 mpfr_sqrt(
c->mf,
c->mf, MPFR_DEFAULT_RND);
457 mpfr_trunc(
c->mf,
c->mf);
481 mpfr_trunc(
d,
c->mf);
482 mpfr_frac(
m,
c->mf, MPFR_DEFAULT_RND);
483 mpfr_mul_ui(
m,
m, 100, MPFR_DEFAULT_RND);
485 mpfr_frac(
s,
m, MPFR_DEFAULT_RND);
487 mpfr_mul_ui(
s,
s, 100, MPFR_DEFAULT_RND);
490 mpfr_div_ui(
m,
m, 60, MPFR_DEFAULT_RND);
491 mpfr_div_ui(
s,
s, 3600, MPFR_DEFAULT_RND);
492 mpfr_add(
c->mf,
d,
m, MPFR_DEFAULT_RND);
493 mpfr_add(
c->mf,
c->mf,
s, MPFR_DEFAULT_RND);
508 mpfr_trunc(
d,
c->mf);
509 mpfr_frac(
m,
c->mf, MPFR_DEFAULT_RND);
510 mpfr_mul_ui(
m,
m, 60, MPFR_DEFAULT_RND);
512 mpfr_frac(
s,
m, MPFR_DEFAULT_RND);
514 mpfr_mul_ui(
s,
s, 60, MPFR_DEFAULT_RND);
517 mpfr_div_ui(
m,
m, 100, MPFR_DEFAULT_RND);
518 mpfr_div_ui(
s,
s, 10000, MPFR_DEFAULT_RND);
519 mpfr_add(
c->mf,
d,
m, MPFR_DEFAULT_RND);
520 mpfr_add(
c->mf,
c->mf,
s, MPFR_DEFAULT_RND);
529 mpfr_set_ui(
c->mf, 0, MPFR_DEFAULT_RND);
534 mpfr_set(
dst->mf,
src->mf, MPFR_DEFAULT_RND);
539 return (mpfr_sgn(
c->mf) == 0);
static double stat_sum(void)
static double stat_sum2(void)
void rpn_2pi(calc_number_t *c)
static void validate_angle2rad(calc_number_t *c)
void rpn_ln(calc_number_t *c)
void rpn_pi(calc_number_t *c)
void rpn_free(calc_number_t *c)
void rpn_sinh(calc_number_t *c)
void rpn_frac(calc_number_t *c)
static void build_rad_const(mpfr_t *mp_pi, mpfr_t *mp_pi_2, mpfr_t *mp_3_pi_2, mpfr_t *mp_2_pi)
void rpn_tan(calc_number_t *c)
void rpn_dec2dms(calc_number_t *c)
void rpn_sqrt(calc_number_t *c)
void rpn_exp3(calc_number_t *c)
void rpn_exp2(calc_number_t *c)
void rpn_int(calc_number_t *c)
void rpn_cbrt(calc_number_t *c)
void rpn_alloc(calc_number_t *c)
void rpn_asin(calc_number_t *c)
void rpn_sin(calc_number_t *c)
void rpn_reci(calc_number_t *c)
void apply_int_mask(calc_number_t *r)
void rpn_exp(calc_number_t *c)
static void validate_rad2angle(calc_number_t *c)
void rpn_sign(calc_number_t *c)
void rpn_atan(calc_number_t *c)
void rpn_asinh(calc_number_t *c)
void rpn_cosh(calc_number_t *c)
void rpn_ave2(calc_number_t *c)
void rpn_fact(calc_number_t *c)
void rpn_log(calc_number_t *c)
void rpn_zero(calc_number_t *c)
static void rpn_s_ex(calc_number_t *c, int pop_type)
void rpn_acos(calc_number_t *c)
void rpn_s(calc_number_t *c)
void rpn_tanh(calc_number_t *c)
void rpn_sum(calc_number_t *c)
int rpn_is_zero(calc_number_t *c)
void rpn_dms2dec(calc_number_t *c)
void rpn_ave(calc_number_t *c)
void rpn_s_m1(calc_number_t *c)
void rpn_cos(calc_number_t *c)
void rpn_sum2(calc_number_t *c)
void rpn_copy(calc_number_t *dst, calc_number_t *src)
void rpn_exp10(calc_number_t *c)
void rpn_acosh(calc_number_t *c)
void rpn_atanh(calc_number_t *c)
void rpn_not(calc_number_t *c)
GLdouble GLdouble GLdouble r
GLboolean GLboolean GLboolean GLboolean a
static int sum(int x_, int y_)
#define SendDlgItemMessage