2014-02-11 11:26:28 +01:00
|
|
|
void sup(void)
|
|
|
|
{
|
2017-04-19 14:13:22 +02:00
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
|
2017-04-21 13:58:44 +02:00
|
|
|
number* right = (number*)_stack->pop_back();
|
2017-04-19 14:13:22 +02:00
|
|
|
number* left = (number*)_stack->back();
|
|
|
|
|
2017-04-29 16:48:14 +02:00
|
|
|
if (mpfr_cmp(left->_value.mpfr, right->_value.mpfr) > 0)
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2014-02-11 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void sup_eq(void)
|
|
|
|
{
|
2017-04-19 14:13:22 +02:00
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
|
2017-04-21 13:58:44 +02:00
|
|
|
number* right = (number*)_stack->pop_back();
|
2017-04-19 14:13:22 +02:00
|
|
|
number* left = (number*)_stack->back();
|
|
|
|
|
2017-04-29 16:48:14 +02:00
|
|
|
if (mpfr_cmp(left->_value.mpfr, right->_value.mpfr) >= 0)
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2014-02-11 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void inf(void)
|
|
|
|
{
|
2017-04-19 14:13:22 +02:00
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
|
2017-04-21 13:58:44 +02:00
|
|
|
number* right = (number*)_stack->pop_back();
|
2017-04-19 14:13:22 +02:00
|
|
|
number* left = (number*)_stack->back();
|
|
|
|
|
2017-04-29 16:48:14 +02:00
|
|
|
if (mpfr_cmp(left->_value.mpfr, right->_value.mpfr) < 0)
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2014-02-11 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void inf_eq(void)
|
|
|
|
{
|
2017-04-19 14:13:22 +02:00
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
|
2017-04-21 13:58:44 +02:00
|
|
|
number* right = (number*)_stack->pop_back();
|
2017-04-19 14:13:22 +02:00
|
|
|
number* left = (number*)_stack->back();
|
|
|
|
|
2017-04-29 16:48:14 +02:00
|
|
|
if (mpfr_cmp(left->_value.mpfr, right->_value.mpfr) <= 0)
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2014-02-11 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void diff(void)
|
|
|
|
{
|
2017-04-19 14:13:22 +02:00
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
|
2017-04-21 13:58:44 +02:00
|
|
|
number* right = (number*)_stack->pop_back();
|
2017-04-19 14:13:22 +02:00
|
|
|
number* left = (number*)_stack->back();
|
|
|
|
|
2017-04-29 16:48:14 +02:00
|
|
|
if (mpfr_cmp(left->_value.mpfr, right->_value.mpfr) != 0)
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2014-02-11 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void eq(void)
|
|
|
|
{
|
2017-04-19 14:13:22 +02:00
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
|
2017-04-21 13:58:44 +02:00
|
|
|
number* right = (number*)_stack->pop_back();
|
2017-04-19 14:13:22 +02:00
|
|
|
number* left = (number*)_stack->back();
|
|
|
|
|
2017-04-29 16:48:14 +02:00
|
|
|
if (mpfr_cmp(left->_value.mpfr, right->_value.mpfr) == 0)
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2014-02-11 11:26:28 +01:00
|
|
|
}
|
2014-09-05 10:37:10 +02:00
|
|
|
|
|
|
|
void test_and(void)
|
|
|
|
{
|
2017-04-19 14:13:22 +02:00
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
|
2017-04-21 13:58:44 +02:00
|
|
|
number* right = (number*)_stack->pop_back();
|
2017-04-19 14:13:22 +02:00
|
|
|
number* left = (number*)_stack->back();
|
|
|
|
|
2017-05-02 11:27:04 +02:00
|
|
|
if ((mpfr_cmp_si(left->_value.mpfr, 0) != 0)
|
|
|
|
&& (mpfr_cmp_si(right->_value.mpfr, 0) != 0))
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2014-09-05 10:37:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void test_or(void)
|
|
|
|
{
|
2017-04-19 14:13:22 +02:00
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
|
2017-04-21 13:58:44 +02:00
|
|
|
number* right = (number*)_stack->pop_back();
|
2017-04-19 14:13:22 +02:00
|
|
|
number* left = (number*)_stack->back();
|
|
|
|
|
2017-05-02 11:27:04 +02:00
|
|
|
if ((mpfr_cmp_si(left->_value.mpfr, 0) != 0)
|
|
|
|
|| (mpfr_cmp_si(right->_value.mpfr, 0) != 0))
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2014-09-05 10:37:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void test_xor(void)
|
|
|
|
{
|
2017-04-19 14:13:22 +02:00
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
|
2017-04-21 13:58:44 +02:00
|
|
|
number* right = (number*)_stack->pop_back();
|
2017-04-19 14:13:22 +02:00
|
|
|
number* left = (number*)_stack->back();
|
|
|
|
|
2017-04-29 16:48:14 +02:00
|
|
|
if (mpfr_cmp_si(left->_value.mpfr, 0) == 0)
|
2017-04-19 14:13:22 +02:00
|
|
|
{
|
2017-04-29 16:48:14 +02:00
|
|
|
if (mpfr_cmp_si(right->_value.mpfr, 0) != 0)
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-04-29 16:48:14 +02:00
|
|
|
if (mpfr_cmp_si(right->_value.mpfr, 0) == 0)
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
}
|
2014-09-05 10:37:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void test_not(void)
|
|
|
|
{
|
2017-04-19 14:13:22 +02:00
|
|
|
MIN_ARGUMENTS(1);
|
|
|
|
ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
|
|
|
|
number* left = (number*)_stack->back();
|
2017-04-29 16:48:14 +02:00
|
|
|
if (mpfr_cmp_si(left->_value.mpfr, 0) == 0)
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 1, floating_t::s_mpfr_rnd);
|
2017-04-19 14:13:22 +02:00
|
|
|
else
|
2017-05-25 18:13:16 +02:00
|
|
|
mpfr_set_si(left->_value.mpfr, 0, floating_t::s_mpfr_rnd);
|
2014-09-05 10:37:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void same(void)
|
|
|
|
{
|
2015-05-19 17:51:03 +02:00
|
|
|
eq();
|
2014-09-05 10:37:10 +02:00
|
|
|
}
|