mirror of
https://github.com/louisrubet/rpn
synced 2024-11-16 07:47:26 +01:00
trig and log tests pass
This commit is contained in:
parent
af5b3def4c
commit
4aa71db351
7 changed files with 299 additions and 703 deletions
|
@ -59,7 +59,7 @@ add_executable(
|
|||
${PROJECT_SOURCE_DIR}/src/rpn-branch.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/rpn-complex.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/rpn-general.cpp
|
||||
#${PROJECT_SOURCE_DIR}/src/rpn-logs.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/rpn-logs.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/rpn-program.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/rpn-real.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/rpn-stack.cpp
|
||||
|
|
|
@ -11,6 +11,7 @@ Changelog
|
|||
- [google c++ style guide](https://google.github.io/styleguide/cppguide.html) applied
|
||||
- Test files are now markdown (.md) files, tests result are slightly changed
|
||||
- Delivery as flatpak and snap
|
||||
- it seems cosh was giving sinh (!)
|
||||
|
||||
grosse perte en performances (!)
|
||||
- v2.3.2 fibo: 0,01s user 0,01s system 97% cpu 0,017 total
|
||||
|
|
|
@ -178,25 +178,25 @@ program::keyword_t program::s_keywords[] = {
|
|||
{cmd_keyword, "r->d", &program::rpn_r2d, "convert radians to degrees"},
|
||||
|
||||
// LOGS ON REALS AND COMPLEXES
|
||||
// {cmd_undef, "", NULL, "\nLOGS ON REALS AND COMPLEXES"},
|
||||
// {cmd_keyword, "e", &program::rpn_e, "Euler constant"},
|
||||
// {cmd_keyword, "ln", &program::rpn_ln, "logarithm base e"},
|
||||
// {cmd_keyword, "log", &program::rpn_ln, ""},
|
||||
// {cmd_keyword, "lnp1", &program::rpn_lnp1, "ln(1+x) which is useful when x is close to 0"},
|
||||
// {cmd_keyword, "exp", &program::rpn_exp, "exponential"},
|
||||
// {cmd_keyword, "expm", &program::rpn_expm, "exp(x)-1 which is useful when x is close to 0"},
|
||||
// {cmd_keyword, "log10", &program::rpn_log10, "logarithm base 10"},
|
||||
// {cmd_keyword, "alog10", &program::rpn_alog10, "exponential base 10"},
|
||||
// {cmd_keyword, "exp10", &program::rpn_alog10, ""},
|
||||
// {cmd_keyword, "log2", &program::rpn_log2, "logarithm base 2"},
|
||||
// {cmd_keyword, "alog2", &program::rpn_alog2, "exponential base 2"},
|
||||
// {cmd_keyword, "exp2", &program::rpn_alog2, ""},
|
||||
// {cmd_keyword, "sinh", &program::rpn_sinh, "hyperbolic sine"},
|
||||
// {cmd_keyword, "asinh", &program::rpn_asinh, "inverse hyperbolic sine"},
|
||||
// {cmd_keyword, "cosh", &program::rpn_sinh, "hyperbolic cosine"},
|
||||
// {cmd_keyword, "acosh", &program::rpn_acosh, "inverse hyperbolic cosine"},
|
||||
// {cmd_keyword, "tanh", &program::rpn_tanh, "hyperbolic tangent"},
|
||||
// {cmd_keyword, "atanh", &program::rpn_atanh, "inverse hyperbolic tangent"},
|
||||
{cmd_undef, "", NULL, "\nLOGS ON REALS AND COMPLEXES"},
|
||||
{cmd_keyword, "e", &program::rpn_e, "Euler constant"},
|
||||
{cmd_keyword, "ln", &program::rpn_ln, "logarithm base e"},
|
||||
{cmd_keyword, "log", &program::rpn_ln, ""},
|
||||
{cmd_keyword, "lnp1", &program::rpn_lnp1, "ln(1+x) which is useful when x is close to 0"},
|
||||
{cmd_keyword, "exp", &program::rpn_exp, "exponential"},
|
||||
{cmd_keyword, "expm", &program::rpn_expm, "exp(x)-1 which is useful when x is close to 0"},
|
||||
{cmd_keyword, "log10", &program::rpn_log10, "logarithm base 10"},
|
||||
{cmd_keyword, "alog10", &program::rpn_alog10, "exponential base 10"},
|
||||
{cmd_keyword, "exp10", &program::rpn_alog10, ""},
|
||||
{cmd_keyword, "log2", &program::rpn_log2, "logarithm base 2"},
|
||||
{cmd_keyword, "alog2", &program::rpn_alog2, "exponential base 2"},
|
||||
{cmd_keyword, "exp2", &program::rpn_alog2, ""},
|
||||
{cmd_keyword, "sinh", &program::rpn_sinh, "hyperbolic sine"},
|
||||
{cmd_keyword, "asinh", &program::rpn_asinh, "inverse hyperbolic sine"},
|
||||
{cmd_keyword, "cosh", &program::rpn_cosh, "hyperbolic cosine"},
|
||||
{cmd_keyword, "acosh", &program::rpn_acosh, "inverse hyperbolic cosine"},
|
||||
{cmd_keyword, "tanh", &program::rpn_tanh, "hyperbolic tangent"},
|
||||
{cmd_keyword, "atanh", &program::rpn_atanh, "inverse hyperbolic tangent"},
|
||||
|
||||
// TIME AND DATE
|
||||
{cmd_undef, "", NULL, "\nTIME AND DATE"},
|
||||
|
|
340
src/rpn-logs.cpp
340
src/rpn-logs.cpp
|
@ -2,28 +2,17 @@
|
|||
|
||||
/// @brief e keyword implementation
|
||||
///
|
||||
void program::rpn_e(void) {
|
||||
number* euler = new number();
|
||||
_stack->push_front(euler);
|
||||
euler->_value = 1L;
|
||||
CHECK_MPFR(mpfr_exp(euler->_value.mpfr, euler->_value.mpfr, mpreal::get_default_rnd()));
|
||||
}
|
||||
void program::rpn_e(void) { _stack->push(new number(const_euler())); }
|
||||
|
||||
/// @brief log10 keyword implementation
|
||||
///
|
||||
void program::rpn_log10() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number || _stack->at(0)->_type == cmd_complex) {
|
||||
// log10(z)=ln(z)/ln(10)
|
||||
rpn_ln();
|
||||
|
||||
number* ten = new number();
|
||||
_stack->push_front(ten);
|
||||
CHECK_MPFR(mpfr_set_d(ten->_value.mpfr, 10.0, mpreal::get_default_rnd()));
|
||||
rpn_ln();
|
||||
rpn_div();
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = log10(_stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = log10(_stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -31,33 +20,23 @@ void program::rpn_log10() {
|
|||
///
|
||||
void program::rpn_alog10() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number || _stack->at(0)->_type == cmd_complex) {
|
||||
floating_t* left = &((number*)_stack->at(0))->_value;
|
||||
number* ten = new number();
|
||||
_stack->push_front(ten);
|
||||
CHECK_MPFR(mpfr_set_d(ten->_value.mpfr, 10.0, mpreal::get_default_rnd()));
|
||||
rpn_ln();
|
||||
rpn_mul();
|
||||
rpn_exp();
|
||||
}
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = exp(log(mpreal(10)) * _stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = exp(log(mpreal(10)) * _stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
/// @brief log2 keyword implementation
|
||||
///
|
||||
void program::rpn_log2() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number || _stack->at(0)->_type == cmd_complex) {
|
||||
// log2(z)=ln(z)/ln(2)
|
||||
rpn_ln();
|
||||
|
||||
number* two = new number();
|
||||
_stack->push_front(two);
|
||||
CHECK_MPFR(mpfr_set_d(two->_value.mpfr, 2.0, mpreal::get_default_rnd()));
|
||||
rpn_ln();
|
||||
rpn_div();
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = log(_stack->value<number>(0)) / const_log2();
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = log(_stack->value<ocomplex>(0)) / const_log2();
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -65,62 +44,23 @@ void program::rpn_log2() {
|
|||
///
|
||||
void program::rpn_alog2() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number || _stack->at(0)->_type == cmd_complex) {
|
||||
floating_t* left = &((number*)_stack->at(0))->_value;
|
||||
number* two = new number();
|
||||
_stack->push_front(two);
|
||||
CHECK_MPFR(mpfr_set_d(two->_value.mpfr, 2.0, mpreal::get_default_rnd()));
|
||||
rpn_ln();
|
||||
rpn_mul();
|
||||
rpn_exp();
|
||||
}
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = exp(const_log2() * _stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = exp(const_log2() * _stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
/// @brief ln keyword implementation
|
||||
///
|
||||
void program::rpn_ln() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number) {
|
||||
number* left = (number*)_stack->back();
|
||||
|
||||
// x<0 -> ln(x) = ln(-x)+i*pi
|
||||
if (mpfr_cmp_si(left->_value.mpfr, 0) < 0) {
|
||||
rpnstack::copy_and_push_front(*_stack, _stack->size() - 1, _calc_stack);
|
||||
_stack->pop_front();
|
||||
left = (number*)_calc_stack.back();
|
||||
|
||||
complex* cplx = new complex();
|
||||
_stack->push_front(cplx);
|
||||
CHECK_MPFR(mpfr_neg(cplx->re()->mpfr, left->_value.mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_log(cplx->re()->mpfr, cplx->re()->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_const_pi(cplx->im()->mpfr, mpreal::get_default_rnd()));
|
||||
_calc_stack.pop_front();
|
||||
} else
|
||||
CHECK_MPFR(mpfr_log(left->_value.mpfr, left->_value.mpfr, mpreal::get_default_rnd()));
|
||||
} else if (_stack->at(0)->_type == cmd_complex) {
|
||||
// ln(x+iy) = 0.5*ln(x*x+y*y) + i atan(x/y)
|
||||
rpnstack::copy_and_push_front(*_stack, _stack->size() - 1, _calc_stack);
|
||||
|
||||
floating_t* x = ((complex*)_calc_stack.at(0))->re();
|
||||
floating_t* y = ((complex*)_calc_stack.at(0))->im();
|
||||
|
||||
floating_t* re = ((complex*)_stack->at(0))->re();
|
||||
floating_t* im = ((complex*)_stack->at(0))->im();
|
||||
|
||||
// 1. atan(x/y)
|
||||
CHECK_MPFR(mpfr_atan2(im->mpfr, y->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
|
||||
// 2. 0.5*ln(x*x+y*y)
|
||||
CHECK_MPFR(mpfr_mul(x->mpfr, x->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_mul(y->mpfr, y->mpfr, y->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_add(re->mpfr, x->mpfr, y->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_log(re->mpfr, re->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_mul_d(re->mpfr, re->mpfr, 0.5, mpreal::get_default_rnd()));
|
||||
|
||||
_calc_stack.pop_front();
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = log(_stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = log(_stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -128,28 +68,11 @@ void program::rpn_ln() {
|
|||
///
|
||||
void program::rpn_exp() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number) {
|
||||
floating_t* left = &((number*)_stack->at(0))->_value;
|
||||
CHECK_MPFR(mpfr_exp(left->mpfr, left->mpfr, mpreal::get_default_rnd()));
|
||||
} else if (_stack->at(0)->_type == cmd_complex) {
|
||||
// exp(x)*(cos(y)+i sin(y))
|
||||
rpnstack::copy_and_push_front(*_stack, _stack->size() - 1, _calc_stack);
|
||||
|
||||
floating_t* x = ((complex*)_calc_stack.at(0))->re();
|
||||
floating_t* y = ((complex*)_calc_stack.at(0))->im();
|
||||
|
||||
floating_t* re = ((complex*)_stack->at(0))->re();
|
||||
floating_t* im = ((complex*)_stack->at(0))->im();
|
||||
|
||||
CHECK_MPFR(mpfr_cos(re->mpfr, y->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_sin(im->mpfr, y->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_exp(x->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_mul(re->mpfr, re->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_mul(im->mpfr, im->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
|
||||
_calc_stack.pop_front();
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = exp(_stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = exp(_stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -157,16 +80,11 @@ void program::rpn_exp() {
|
|||
///
|
||||
void program::rpn_expm() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number || _stack->at(0)->_type == cmd_complex) {
|
||||
// exp(x)-1
|
||||
rpn_exp();
|
||||
|
||||
number* one = new number();
|
||||
_stack->push_front(one);
|
||||
CHECK_MPFR(mpfr_set_d(one->_value.mpfr, 1.0, mpreal::get_default_rnd()));
|
||||
rpn_minus();
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = exp(_stack->value<number>(0)) - mpreal(1);
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = exp(_stack->value<ocomplex>(0)) - mpreal(1);
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -174,16 +92,11 @@ void program::rpn_expm() {
|
|||
///
|
||||
void program::rpn_lnp1() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number || _stack->at(0)->_type == cmd_complex) {
|
||||
// ln(x+1)
|
||||
number* one = new number();
|
||||
_stack->push_front(one);
|
||||
CHECK_MPFR(mpfr_set_d(one->_value.mpfr, 1.0, mpreal::get_default_rnd()));
|
||||
rpn_plus();
|
||||
|
||||
rpn_ln();
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = log(_stack->value<number>(0) + 1);
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = log(_stack->value<ocomplex>(0) + mpreal(1));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -191,33 +104,11 @@ void program::rpn_lnp1() {
|
|||
///
|
||||
void program::rpn_sinh() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number) {
|
||||
floating_t* left = &((number*)_stack->at(0))->_value;
|
||||
CHECK_MPFR(mpfr_sinh(left->mpfr, left->mpfr, mpreal::get_default_rnd()));
|
||||
} else if (_stack->at(0)->_type == cmd_complex) {
|
||||
// sinh(x+iy)=sinh(x)cos(y)+icosh(x)sin(y)
|
||||
rpnstack::copy_and_push_front(*_stack, _stack->size() - 1, _calc_stack);
|
||||
|
||||
number* num = new number();
|
||||
_stack->push_front(num);
|
||||
floating_t* tmp = &num->_value;
|
||||
floating_t* x = ((complex*)_calc_stack.at(1))->re();
|
||||
floating_t* y = ((complex*)_calc_stack.at(1))->im();
|
||||
|
||||
floating_t* re = ((complex*)_stack->at(0))->re();
|
||||
floating_t* im = ((complex*)_stack->at(0))->im();
|
||||
|
||||
CHECK_MPFR(mpfr_sinh(re->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_cos(tmp->mpfr, y->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_mul(re->mpfr, re->mpfr, tmp->mpfr, mpreal::get_default_rnd()));
|
||||
|
||||
CHECK_MPFR(mpfr_cosh(im->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_sin(tmp->mpfr, y->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_mul(im->mpfr, im->mpfr, tmp->mpfr, mpreal::get_default_rnd()));
|
||||
|
||||
_calc_stack.pop_front(2);
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = sinh(_stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = sinh(_stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -225,22 +116,11 @@ void program::rpn_sinh() {
|
|||
///
|
||||
void program::rpn_asinh() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number) {
|
||||
floating_t* left = &((number*)_stack->at(0))->_value;
|
||||
CHECK_MPFR(mpfr_asinh(left->mpfr, left->mpfr, mpreal::get_default_rnd()));
|
||||
} else if (_stack->at(0)->_type == cmd_complex) {
|
||||
// asinh(z)=ln(z+sqrt(1+z*z))
|
||||
rpn_dup();
|
||||
rpn_square();
|
||||
number* num = new number();
|
||||
_stack->push_front(num);
|
||||
CHECK_MPFR(mpfr_set_d(num->_value.mpfr, 1.0, mpreal::get_default_rnd()));
|
||||
rpn_plus();
|
||||
rpn_squareroot();
|
||||
rpn_plus();
|
||||
rpn_ln();
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = asinh(_stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = asinh(_stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -248,33 +128,11 @@ void program::rpn_asinh() {
|
|||
///
|
||||
void program::rpn_cosh() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number) {
|
||||
floating_t* left = &((number*)_stack->at(0))->_value;
|
||||
CHECK_MPFR(mpfr_cosh(left->mpfr, left->mpfr, mpreal::get_default_rnd()));
|
||||
} else if (_stack->at(0)->_type == cmd_complex) {
|
||||
// acosh(x+iy)=cosh(x)cos(y)+isinh(x)sin(y)
|
||||
rpnstack::copy_and_push_front(*_stack, _stack->size() - 1, _calc_stack);
|
||||
|
||||
number* num = new number();
|
||||
_stack->push_front(num);
|
||||
floating_t* tmp = &num->_value;
|
||||
floating_t* x = ((complex*)_calc_stack.at(1))->re();
|
||||
floating_t* y = ((complex*)_calc_stack.at(1))->im();
|
||||
|
||||
floating_t* re = ((complex*)_stack->at(0))->re();
|
||||
floating_t* im = ((complex*)_stack->at(0))->im();
|
||||
|
||||
CHECK_MPFR(mpfr_cosh(re->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_cos(tmp->mpfr, y->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_mul(re->mpfr, re->mpfr, tmp->mpfr, mpreal::get_default_rnd()));
|
||||
|
||||
CHECK_MPFR(mpfr_sinh(im->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_sin(tmp->mpfr, y->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_mul(im->mpfr, im->mpfr, tmp->mpfr, mpreal::get_default_rnd()));
|
||||
|
||||
_calc_stack.pop_front(2);
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = cosh(_stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = cosh(_stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -282,27 +140,11 @@ void program::rpn_cosh() {
|
|||
///
|
||||
void program::rpn_acosh() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number) {
|
||||
floating_t* left = &((number*)_stack->at(0))->_value;
|
||||
CHECK_MPFR(mpfr_acosh(left->mpfr, left->mpfr, mpreal::get_default_rnd()));
|
||||
} else if (_stack->at(0)->_type == cmd_complex) {
|
||||
// acosh(z)=ln(z+sqrt(z+1)sqrt(z-1))
|
||||
rpn_dup();
|
||||
number* num = new number();
|
||||
_stack->push_front(num);
|
||||
CHECK_MPFR(mpfr_set_d(num->_value.mpfr, 1.0, mpreal::get_default_rnd()));
|
||||
rpn_plus();
|
||||
rpn_dup();
|
||||
num = (number*)new number();
|
||||
_stack->push_front(num);
|
||||
CHECK_MPFR(mpfr_set_d(num->_value.mpfr, 2.0, mpreal::get_default_rnd()));
|
||||
rpn_minus();
|
||||
rpn_mul();
|
||||
rpn_squareroot();
|
||||
rpn_plus();
|
||||
rpn_ln();
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = acosh(_stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = acosh(_stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -310,29 +152,11 @@ void program::rpn_acosh() {
|
|||
///
|
||||
void program::rpn_tanh() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number) {
|
||||
floating_t* left = &((number*)_stack->at(0))->_value;
|
||||
CHECK_MPFR(mpfr_tanh(left->mpfr, left->mpfr, mpreal::get_default_rnd()));
|
||||
} else if (_stack->at(0)->_type == cmd_complex) {
|
||||
// tanh(x+iy)=(tanh(x)+itan(y)) / (1 + itanh(x)tan(y))
|
||||
rpn_dup();
|
||||
|
||||
floating_t* x = ((complex*)_stack->at(1))->re();
|
||||
floating_t* y = ((complex*)_stack->at(1))->im();
|
||||
|
||||
floating_t* re = ((complex*)_stack->at(1))->re();
|
||||
floating_t* im = ((complex*)_stack->at(1))->im();
|
||||
|
||||
CHECK_MPFR(mpfr_tanh(re->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_tan(im->mpfr, y->mpfr, mpreal::get_default_rnd()));
|
||||
|
||||
CHECK_MPFR(mpfr_tanh(x->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_tan(y->mpfr, y->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_mul(y->mpfr, y->mpfr, x->mpfr, mpreal::get_default_rnd()));
|
||||
CHECK_MPFR(mpfr_set_d(x->mpfr, 1.0, mpreal::get_default_rnd()));
|
||||
rpn_div();
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = tanh(_stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = tanh(_stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
||||
|
@ -340,28 +164,10 @@ void program::rpn_tanh() {
|
|||
///
|
||||
void program::rpn_atanh() {
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
if (_stack->at(0)->_type == cmd_number) {
|
||||
floating_t* left = &((number*)_stack->at(0))->_value;
|
||||
CHECK_MPFR(mpfr_atanh(left->mpfr, left->mpfr, mpreal::get_default_rnd()));
|
||||
} else if (_stack->at(0)->_type == cmd_complex) {
|
||||
// atanh(z)=0.5*ln((1+z)/(1-z))
|
||||
rpn_dup();
|
||||
|
||||
number* num;
|
||||
_stack->push_front(num = new number);
|
||||
CHECK_MPFR(mpfr_set_d(num->_value.mpfr, 1.0, mpreal::get_default_rnd()));
|
||||
rpn_plus();
|
||||
rpn_swap();
|
||||
_stack->push_front(num = new number);
|
||||
CHECK_MPFR(mpfr_set_d(num->_value.mpfr, 1.0, mpreal::get_default_rnd()));
|
||||
rpn_minus();
|
||||
rpn_neg();
|
||||
rpn_div();
|
||||
rpn_ln();
|
||||
_stack->push_front(num = new number);
|
||||
CHECK_MPFR(mpfr_set_d(num->_value.mpfr, 0.5, mpreal::get_default_rnd()));
|
||||
rpn_mul();
|
||||
} else
|
||||
if (_stack->type(0) == cmd_number)
|
||||
_stack->value<number>(0) = atanh(_stack->value<number>(0));
|
||||
else if (_stack->type(0) == cmd_complex)
|
||||
_stack->value<ocomplex>(0) = atanh(_stack->value<ocomplex>(0));
|
||||
else
|
||||
ERR_CONTEXT(ret_bad_operand_type);
|
||||
}
|
||||
|
|
|
@ -1,37 +1,105 @@
|
|||
# TRIGONOMETRY
|
||||
|
||||
`del default`
|
||||
`del default 6 fix`
|
||||
|
||||
## pi
|
||||
|
||||
`6 fix pi`
|
||||
`pi`
|
||||
|
||||
-> stack should be 3.141593
|
||||
|
||||
`del default`
|
||||
`del`
|
||||
|
||||
## real sin asin
|
||||
## d->r
|
||||
|
||||
`180 d->r pi ==`
|
||||
|
||||
-> stack should be 1.000000
|
||||
|
||||
`del`
|
||||
|
||||
## r->d
|
||||
|
||||
`pi r->d 180 ==`
|
||||
|
||||
-> stack should be 1.000000
|
||||
|
||||
`del`
|
||||
|
||||
## sin asin
|
||||
|
||||
`0 sin pi 2 / sin pi 6 / sin`
|
||||
`0 asin 0 == 1 asin pi 2 / == 0.5 asin pi 6 / ==`
|
||||
|
||||
-> stack should be 0, 1, 0.5, 1, 1, 1
|
||||
-> stack should be 0.000000, 1.000000, 0.500000, 1.000000, 1.000000, 1.000000
|
||||
|
||||
`del`
|
||||
|
||||
## real cos acos
|
||||
## cos acos
|
||||
|
||||
`0 cos pi 3 / cos`
|
||||
`1 acos 0 == 0.5 acos pi 3 / ==`
|
||||
|
||||
-> stack should be 1, 0.5, 1, 1
|
||||
-> stack should be 1.000000, 0.500000, 1.000000, 1.000000
|
||||
|
||||
`del`
|
||||
|
||||
## real tan atan
|
||||
## tan atan
|
||||
|
||||
`pi 4 / tan 1 == 1 atan pi 4 / ==`
|
||||
|
||||
-> stack should be 1, 1
|
||||
-> stack should be 1.000000, 1.000000
|
||||
|
||||
`del`
|
||||
|
||||
## sin asin
|
||||
|
||||
`(1,2) sin (3.165779,1.959601) asin`
|
||||
|
||||
-> stack should be (3.165779,1.959601), (1.000000,2.000000)
|
||||
|
||||
`del`
|
||||
|
||||
## cos acos
|
||||
|
||||
`(1,2) cos (2.032723,-3.051898) acos`
|
||||
|
||||
-> stack should be (2.032723,-3.051898), (1.000000,2.000000)
|
||||
|
||||
`del`
|
||||
|
||||
## tan atan
|
||||
|
||||
`(1,2) tan (0.033813,1.014794) atan`
|
||||
|
||||
-> stack should be (0.033813,1.014794), (1.000004,1.999996)
|
||||
|
||||
`del`
|
||||
|
||||
## sin asin cos acos tan atan error
|
||||
|
||||
`'ok' sin`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`asin`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`cos`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`acos`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`tan`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`atan`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`del`
|
||||
|
|
531
test/130-logs.md
531
test/130-logs.md
|
@ -1,498 +1,219 @@
|
|||
# LOGARITHMS
|
||||
|
||||
## complex ln (1)
|
||||
`del default 6 fix`
|
||||
|
||||
`(1,2) ln`
|
||||
## euler constant
|
||||
|
||||
-> stack should be (0.804719,1.107149)
|
||||
`e`
|
||||
|
||||
-> stack should be 0.577216
|
||||
|
||||
`del`
|
||||
|
||||
## complex ln (2)
|
||||
## ln log exp
|
||||
|
||||
`(1,-2) ln`
|
||||
`2 ln exp`
|
||||
|
||||
-> stack should be (0.804719,-1.107149)
|
||||
`2 log exp`
|
||||
|
||||
-> stack should be 2.000000, 2.000000
|
||||
|
||||
`del`
|
||||
|
||||
## lnp1 expm
|
||||
|
||||
`4 lnp1 expm`
|
||||
|
||||
-> stack should be 4.000000
|
||||
|
||||
`del`
|
||||
|
||||
|
||||
## complex ln (3)
|
||||
## log10 alog10 exp10
|
||||
|
||||
`(-1,-2) ln`
|
||||
`5 log10 alog10`
|
||||
|
||||
-> stack should be (0.804719,-2.034444)
|
||||
`5 log10 exp10`
|
||||
|
||||
-> stack should be 5.000000, 5.000000
|
||||
|
||||
`del`
|
||||
|
||||
## complex ln (4)
|
||||
## log2 alog2 exp2
|
||||
|
||||
`(-1,2) ln`
|
||||
`6 log2 alog2`
|
||||
|
||||
-> stack should be (0.804719,2.034444)
|
||||
`6 log2 exp2`
|
||||
|
||||
-> stack should be 6.000000, 6.000000
|
||||
|
||||
`del`
|
||||
|
||||
## complex lnp1 (1)
|
||||
## sinh asinh
|
||||
|
||||
`(1,2) lnp1`
|
||||
|
||||
`(1,2) 1 + ln ==`
|
||||
`1 sinh asinh`
|
||||
|
||||
-> stack should be 1.000000
|
||||
|
||||
`del`
|
||||
|
||||
## complex lnp1 (2)
|
||||
## cosh acosh
|
||||
|
||||
`(1,-2) lnp1`
|
||||
`1.1 cosh acosh`
|
||||
|
||||
`(1,-2) 1 + ln ==`
|
||||
|
||||
-> stack should be 1.000000
|
||||
-> stack should be 1.100000
|
||||
|
||||
`del`
|
||||
|
||||
## complex lnp1 (3)
|
||||
## tanh atanh
|
||||
|
||||
`(-1,-2) lnp1`
|
||||
`1.2 tanh atanh`
|
||||
|
||||
`(-1,-2) 1 + ln ==`
|
||||
|
||||
-> stack should be 1.000000
|
||||
-> stack should be 1.200000
|
||||
|
||||
`del`
|
||||
|
||||
## complex lnp1 (4)
|
||||
## complex ln exp
|
||||
|
||||
`(-1,2) lnp1`
|
||||
`(-1,-2) ln exp`
|
||||
|
||||
`(-1,2) 1 + ln ==`
|
||||
|
||||
-> stack should be 1.000000
|
||||
-> stack should be (-1.000000,-2.000000)
|
||||
|
||||
`del`
|
||||
|
||||
## complex log (1)
|
||||
## complex log exp
|
||||
|
||||
`(1,2) log`
|
||||
`(1,2) log exp`
|
||||
|
||||
-> stack should be (0.804719,1.107149)
|
||||
-> stack should be (1.000000,2.000000)
|
||||
|
||||
`del`
|
||||
|
||||
## complex log (2)
|
||||
## complex lnp1 expm
|
||||
|
||||
`(1,-2) log`
|
||||
`(1,2) lnp1 expm`
|
||||
|
||||
-> stack should be (0.804719,-1.107149)
|
||||
-> stack should be (1.000000,2.000000)
|
||||
|
||||
`del`
|
||||
|
||||
## complex log (3)
|
||||
## complex log10 alog10
|
||||
|
||||
`(-1,-2) log`
|
||||
`(1,-2) log10 alog10`
|
||||
|
||||
-> stack should be (0.804719,-2.034444)
|
||||
-> stack should be (1.000000,-2.000000)
|
||||
|
||||
`del`
|
||||
|
||||
## complex log (4)
|
||||
|
||||
`(-1,2) log`
|
||||
## complex log2 alog2
|
||||
|
||||
-> stack should be (0.804719,2.034444)
|
||||
`(-1,-2) log2 alog2`
|
||||
|
||||
-> stack should be (-1.000000,-2.000000)
|
||||
|
||||
`del`
|
||||
|
||||
## complex log10 (1)
|
||||
## complex sinh asinh
|
||||
|
||||
`(1,2) log10`
|
||||
`(1,1.5) sinh asinh`
|
||||
|
||||
-> stack should be (0.349485,0.480829)
|
||||
-> stack should be (1.000000,1.500000)
|
||||
|
||||
`del`
|
||||
|
||||
## complex log10 (2)
|
||||
## complex cosh acosh
|
||||
|
||||
`(1,-2) log10`
|
||||
`(1,2) cosh acosh`
|
||||
|
||||
-> stack should be (0.349485,-0.480829)
|
||||
-> stack should be (1.000000,2.000000)
|
||||
|
||||
`del`
|
||||
|
||||
## complex log10 (3)
|
||||
## complex tanh atanh
|
||||
|
||||
`(-1,-2) log10`
|
||||
`(1,1.5) tanh atanh`
|
||||
|
||||
-> stack should be (0.349485,-0.883548)
|
||||
-> stack should be (1.000000,1.500000)
|
||||
|
||||
`del`
|
||||
|
||||
## complex log10 (4)
|
||||
## ln log lnp1 exp expm error
|
||||
|
||||
`(-1,2) log10`
|
||||
`'ok' ln`
|
||||
|
||||
-> stack should be (0.349485,0.883548)
|
||||
-> error should be 3
|
||||
|
||||
`log`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`lnp1`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`exp`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`expm`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`del`
|
||||
|
||||
## complex log2 (1)
|
||||
## log10 alog10 exp10 log2 alog2 exp2 error
|
||||
|
||||
`(1,2) log2`
|
||||
`'ok' log10`
|
||||
|
||||
-> stack should be (1.160964,1.597278)
|
||||
-> error should be 3
|
||||
|
||||
`alog10`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`exp10`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`log2`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`alog2`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`exp2`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`del`
|
||||
|
||||
## complex log2 (2)
|
||||
## sinh asinh cosh acosh tanh atanh error
|
||||
|
||||
`(1,-2) log2`
|
||||
`'ok' sinh`
|
||||
|
||||
-> stack should be (1.160964,-1.597278)
|
||||
|
||||
`del`
|
||||
|
||||
## complex log2 (3)
|
||||
|
||||
`(-1,-2) log2`
|
||||
|
||||
-> stack should be (1.160964,-2.935082)
|
||||
|
||||
`del`
|
||||
|
||||
## complex log2 (4)
|
||||
|
||||
`(-1,2) log2`
|
||||
|
||||
-> stack should be (1.160964,2.935082)
|
||||
|
||||
`del`
|
||||
|
||||
## complex exp (1)
|
||||
|
||||
`(1,2) exp`
|
||||
|
||||
-> stack should be (-1.131204,2.471727)
|
||||
|
||||
`del`
|
||||
|
||||
## complex exp (2)
|
||||
|
||||
`(1,-2) exp`
|
||||
|
||||
-> stack should be (-1.131204,-2.471727)
|
||||
|
||||
`del`
|
||||
|
||||
## complex exp (3)
|
||||
|
||||
`(-1,-2) exp`
|
||||
|
||||
-> stack should be (-0.153092,-0.334512)
|
||||
|
||||
`del`
|
||||
|
||||
## complex exp (4)
|
||||
|
||||
`(-1,2) exp`
|
||||
|
||||
-> stack should be (-0.153092,0.334512)
|
||||
|
||||
`del`
|
||||
|
||||
## complex expm (1)
|
||||
|
||||
`(1,2) expm`
|
||||
|
||||
`(1,2) exp 1 - ==`
|
||||
|
||||
-> stack should be 1.000000
|
||||
|
||||
`del`
|
||||
|
||||
## complex expm (2)
|
||||
|
||||
`(1,-2) expm`
|
||||
|
||||
`(1,-2) exp 1 - ==`
|
||||
|
||||
-> stack should be 1.000000
|
||||
|
||||
`del`
|
||||
|
||||
## complex expm (3)
|
||||
|
||||
`(-1,-2) expm`
|
||||
|
||||
`(-1,-2) exp 1 - ==`
|
||||
|
||||
-> stack should be 1.000000
|
||||
|
||||
`del`
|
||||
|
||||
## complex expm (4)
|
||||
|
||||
`(-1,2) expm`
|
||||
|
||||
`(-1,2) exp 1 - ==`
|
||||
|
||||
-> stack should be 1.000000
|
||||
|
||||
`del`
|
||||
|
||||
## complex alog2 (1)
|
||||
|
||||
`(1,2) alog2`
|
||||
|
||||
-> stack should be (0.366914,1.966055)
|
||||
|
||||
`del`
|
||||
|
||||
## complex alog2 (2)
|
||||
|
||||
`(1,-2) alog2`
|
||||
|
||||
-> stack should be (0.366914,-1.966055)
|
||||
|
||||
`del`
|
||||
|
||||
## complex alog2 (3)
|
||||
|
||||
`(-1,-2) alog2`
|
||||
|
||||
-> stack should be (0.091728,-0.491514)
|
||||
|
||||
`del`
|
||||
|
||||
## complex alog2 (4)
|
||||
|
||||
`(-1,2) alog2`
|
||||
|
||||
-> stack should be (0.091728,0.491514)
|
||||
|
||||
`del`
|
||||
|
||||
## complex alog10 (1)
|
||||
|
||||
`(1,2) alog10`
|
||||
|
||||
-> stack should be (-1.070135,-9.942576)
|
||||
|
||||
`del`
|
||||
|
||||
## complex alog10 (2)
|
||||
|
||||
`(1,-2) alog10`
|
||||
|
||||
-> stack should be (-1.070135,9.942576)
|
||||
|
||||
`del`
|
||||
|
||||
## complex alog10 (3)
|
||||
|
||||
`(-1,-2) alog10`
|
||||
|
||||
-> stack should be (-0.010701,0.099426)
|
||||
|
||||
`del`
|
||||
|
||||
## complex alog10 (4)
|
||||
|
||||
`(-1,2) alog10`
|
||||
|
||||
-> stack should be (-0.010701,-0.099426)
|
||||
|
||||
`del`
|
||||
|
||||
## complex sinh (1)
|
||||
|
||||
`(1,2) sinh`
|
||||
|
||||
-> stack should be (-0.489056,1.403119)
|
||||
|
||||
`del`
|
||||
|
||||
## complex sinh (2)
|
||||
|
||||
`(1,-2) sinh`
|
||||
|
||||
-> stack should be (-0.489056,-1.403119)
|
||||
|
||||
`del`
|
||||
|
||||
## complex sinh (3)
|
||||
|
||||
`(-1,-2) sinh`
|
||||
|
||||
-> stack should be (0.489056,-1.403119)
|
||||
|
||||
`del`
|
||||
|
||||
## complex sinh (4)
|
||||
|
||||
`(-1,2) sinh`
|
||||
|
||||
-> stack should be (0.489056,1.403119)
|
||||
|
||||
`del`
|
||||
|
||||
## complex asinh (1)
|
||||
|
||||
`(1,2) asinh`
|
||||
|
||||
-> stack should be (1.469352,1.063440)
|
||||
|
||||
`del`
|
||||
|
||||
## complex asinh (2)
|
||||
|
||||
`(1,-2) asinh`
|
||||
|
||||
-> stack should be (1.469352,-1.063440)
|
||||
|
||||
`del`
|
||||
|
||||
## complex asinh (3)
|
||||
|
||||
`(-1,-2) asinh`
|
||||
|
||||
-> stack should be (-1.469352,-1.063440)
|
||||
|
||||
`del`
|
||||
|
||||
## complex asinh (4)
|
||||
|
||||
`(-1,2) asinh`
|
||||
|
||||
-> stack should be (-1.469352,1.063440)
|
||||
|
||||
`del`
|
||||
|
||||
## complex cosh (1)
|
||||
|
||||
`(1,2) cosh`
|
||||
|
||||
-> stack should be (-0.489056,1.403119)
|
||||
|
||||
`del`
|
||||
|
||||
## complex cosh (2)
|
||||
|
||||
`(1,-2) cosh`
|
||||
|
||||
-> stack should be (-0.489056,-1.403119)
|
||||
|
||||
`del`
|
||||
|
||||
## complex cosh (3)
|
||||
|
||||
`(-1,-2) cosh`
|
||||
|
||||
-> stack should be (0.489056,-1.403119)
|
||||
|
||||
`del`
|
||||
|
||||
## complex cosh (4)
|
||||
|
||||
`(-1,2) cosh`
|
||||
|
||||
-> stack should be (0.489056,1.403119)
|
||||
|
||||
`del`
|
||||
|
||||
## complex acosh (1)
|
||||
|
||||
`(1,2) acosh`
|
||||
|
||||
-> stack should be (1.528571,1.143718)
|
||||
|
||||
`del`
|
||||
|
||||
## complex acosh (2)
|
||||
|
||||
`(1,-2) acosh`
|
||||
|
||||
-> stack should be (1.528571,-1.143718)
|
||||
|
||||
`del`
|
||||
|
||||
## complex acosh (3)
|
||||
|
||||
`(-1,-2) acosh`
|
||||
|
||||
-> stack should be (-1.528571,1.997875)
|
||||
|
||||
`del`
|
||||
|
||||
## complex acosh (4)
|
||||
|
||||
`(-1,2) acosh`
|
||||
|
||||
-> stack should be (-1.528571,-1.997875)
|
||||
|
||||
`del`
|
||||
|
||||
## complex tanh (1)
|
||||
|
||||
`(1,2) tanh`
|
||||
|
||||
-> stack should be (0.564133,-0.217934)
|
||||
|
||||
`del`
|
||||
|
||||
## complex tanh (2)
|
||||
|
||||
`(1,-2) tanh`
|
||||
|
||||
-> stack should be (0.564133,0.217934)
|
||||
|
||||
`del`
|
||||
|
||||
## complex tanh (3)
|
||||
|
||||
`(-1,-2) tanh`
|
||||
|
||||
-> stack should be (-0.564133,0.217934)
|
||||
|
||||
`del`
|
||||
|
||||
## complex tanh (4)
|
||||
|
||||
`(-1,2) tanh`
|
||||
|
||||
-> stack should be (-0.564133,-0.217934)
|
||||
|
||||
`del`
|
||||
|
||||
## complex atanh (1)
|
||||
|
||||
`(1,2) atanh`
|
||||
|
||||
-> stack should be (0.173287,1.178097)
|
||||
|
||||
`del`
|
||||
|
||||
## complex atanh (2)
|
||||
|
||||
`(1,-2) atanh`
|
||||
|
||||
-> stack should be (0.173287,-1.178097)
|
||||
|
||||
`del`
|
||||
|
||||
## complex atanh (3)
|
||||
|
||||
`(-1,-2) atanh`
|
||||
|
||||
-> stack should be (-0.173287,-1.178097)
|
||||
|
||||
`del`
|
||||
|
||||
## complex atanh (4)
|
||||
|
||||
`(-1,2) atanh`
|
||||
|
||||
-> stack should be (-0.173287,1.178097)
|
||||
-> error should be 3
|
||||
|
||||
`asinh`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`cosh`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`acosh`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`tanh`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`atanh`
|
||||
|
||||
-> error should be 3
|
||||
|
||||
`del`
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
@include 090-program.md
|
||||
@include 100-complex.md
|
||||
@include 110-time.md
|
||||
# @include 120-trig.md
|
||||
# @include 130-logs.md
|
||||
@include 120-trig.md
|
||||
@include 130-logs.md
|
||||
# @include 999-manual-tests.md
|
||||
|
|
Loading…
Reference in a new issue