Category talk:Wren-gmp: Difference between revisions
Content deleted Content added
→Source code (Wren): Added some more methods to Mpf class. |
→Source code (C): Wrapped 5 more mpfr functions. |
||
Line 2,791: | Line 2,791: | ||
mpfr_clear(ry); |
mpfr_clear(ry); |
||
mpfr_clear(rx); |
mpfr_clear(rx); |
||
mpfr_clear(res); |
|||
} |
|||
void Mpf_cosh(WrenVM* vm) { |
|||
mpfr_t op, res; |
|||
mpf_t *pf = (mpf_t*)wrenGetSlotForeign(vm, 0); |
|||
mpf_t *pop = (mpf_t*)wrenGetSlotForeign(vm, 1); |
|||
mpfr_prec_t prec1 = (mpfr_prec_t)mpf_get_prec(*pf); |
|||
mpfr_init2(res, prec1); |
|||
mpfr_prec_t prec2 = (mpfr_prec_t)mpf_get_prec(*pop); |
|||
mpfr_init2(op, prec2); |
|||
mpfr_set_f(op, *pop, MPFR_RNDN); |
|||
mpfr_cosh(res, op, MPFR_RNDN); |
|||
mpfr_get_f(*pf, res, MPFR_RNDN); |
|||
mpfr_clear(op); |
|||
mpfr_clear(res); |
|||
} |
|||
void Mpf_sinh(WrenVM* vm) { |
|||
mpfr_t op, res; |
|||
mpf_t *pf = (mpf_t*)wrenGetSlotForeign(vm, 0); |
|||
mpf_t *pop = (mpf_t*)wrenGetSlotForeign(vm, 1); |
|||
mpfr_prec_t prec1 = (mpfr_prec_t)mpf_get_prec(*pf); |
|||
mpfr_init2(res, prec1); |
|||
mpfr_prec_t prec2 = (mpfr_prec_t)mpf_get_prec(*pop); |
|||
mpfr_init2(op, prec2); |
|||
mpfr_set_f(op, *pop, MPFR_RNDN); |
|||
mpfr_sinh(res, op, MPFR_RNDN); |
|||
mpfr_get_f(*pf, res, MPFR_RNDN); |
|||
mpfr_clear(op); |
|||
mpfr_clear(res); |
|||
} |
|||
void Mpf_tanh(WrenVM* vm) { |
|||
mpfr_t op, res; |
|||
mpf_t *pf = (mpf_t*)wrenGetSlotForeign(vm, 0); |
|||
mpf_t *pop = (mpf_t*)wrenGetSlotForeign(vm, 1); |
|||
mpfr_prec_t prec1 = (mpfr_prec_t)mpf_get_prec(*pf); |
|||
mpfr_init2(res, prec1); |
|||
mpfr_prec_t prec2 = (mpfr_prec_t)mpf_get_prec(*pop); |
|||
mpfr_init2(op, prec2); |
|||
mpfr_set_f(op, *pop, MPFR_RNDN); |
|||
mpfr_tanh(res, op, MPFR_RNDN); |
|||
mpfr_get_f(*pf, res, MPFR_RNDN); |
|||
mpfr_clear(op); |
|||
mpfr_clear(res); |
|||
} |
|||
void Mpf_gamma(WrenVM* vm) { |
|||
mpfr_t op, res; |
|||
mpf_t *pf = (mpf_t*)wrenGetSlotForeign(vm, 0); |
|||
mpf_t *pop = (mpf_t*)wrenGetSlotForeign(vm, 1); |
|||
mpfr_prec_t prec1 = (mpfr_prec_t)mpf_get_prec(*pf); |
|||
mpfr_init2(res, prec1); |
|||
mpfr_prec_t prec2 = (mpfr_prec_t)mpf_get_prec(*pop); |
|||
mpfr_init2(op, prec2); |
|||
mpfr_set_f(op, *pop, MPFR_RNDN); |
|||
mpfr_gamma(res, op, MPFR_RNDN); |
|||
mpfr_get_f(*pf, res, MPFR_RNDN); |
|||
mpfr_clear(op); |
|||
mpfr_clear(res); |
|||
} |
|||
void Mpf_digamma(WrenVM* vm) { |
|||
mpfr_t op, res; |
|||
mpf_t *pf = (mpf_t*)wrenGetSlotForeign(vm, 0); |
|||
mpf_t *pop = (mpf_t*)wrenGetSlotForeign(vm, 1); |
|||
mpfr_prec_t prec1 = (mpfr_prec_t)mpf_get_prec(*pf); |
|||
mpfr_init2(res, prec1); |
|||
mpfr_prec_t prec2 = (mpfr_prec_t)mpf_get_prec(*pop); |
|||
mpfr_init2(op, prec2); |
|||
mpfr_set_f(op, *pop, MPFR_RNDN); |
|||
mpfr_digamma(res, op, MPFR_RNDN); |
|||
mpfr_get_f(*pf, res, MPFR_RNDN); |
|||
mpfr_clear(op); |
|||
mpfr_clear(res); |
mpfr_clear(res); |
||
} |
} |
||
Line 3,025: | Line 3,100: | ||
if(!isStatic && strcmp(signature, "atan(_)") == 0) return Mpf_atan; |
if(!isStatic && strcmp(signature, "atan(_)") == 0) return Mpf_atan; |
||
if(!isStatic && strcmp(signature, "atan2(_,_)") == 0) return Mpf_atan2; |
if(!isStatic && strcmp(signature, "atan2(_,_)") == 0) return Mpf_atan2; |
||
if(!isStatic && strcmp(signature, "cosh(_)") == 0) return Mpf_cosh; |
|||
if(!isStatic && strcmp(signature, "sinh(_)") == 0) return Mpf_sinh; |
|||
if(!isStatic && strcmp(signature, "tanh(_)") == 0) return Mpf_tanh; |
|||
if(!isStatic && strcmp(signature, "gamma(_)") == 0) return Mpf_gamma; |
|||
if(!isStatic && strcmp(signature, "digamma(_)") == 0) return Mpf_digamma; |
|||
} |
} |
||
} |
} |