rpn/src/rpn-real.h

206 lines
4.1 KiB
C
Raw Normal View History

void plus()
{
MIN_ARGUMENTS(2);
2017-04-17 23:10:53 +02:00
//TODO
//// float
//if (IS_ARG_TYPE(0, cmd_number))
//{
// ARG_MUST_BE_OF_TYPE(1, cmd_number);
// //TODO really too slow
// putf(getf() + getf());
//}
//// binary
//else if (IS_ARG_TYPE(0, cmd_binary))
//{
// ARG_MUST_BE_OF_TYPE(1, cmd_binary);
// //TODO really too slow
// putb(getb() + getb());
//}
//TODO
#if 0
// string
else if (IS_ARG_TYPE(0, cmd_string))
{
ARG_MUST_BE_OF_TYPE(1, cmd_string);
string& second = *((ostring*)_stack->back())->_value;
_stack->pop_back();
*((ostring*)_stack->back())->_value += second;
}
#endif
2017-04-17 23:10:53 +02:00
//else
// ERR_CONTEXT(ret_bad_operand_type);
}
void minus()
{
MIN_ARGUMENTS(2);
2017-04-17 23:10:53 +02:00
//TODO
//// float
//if (IS_ARG_TYPE(0, cmd_number))
//{
// ARG_MUST_BE_OF_TYPE(1, cmd_number);
// //TODO really too slow
// floating_t first = getf();
// putf(getf() - first);
//}
//// binary
//else if (IS_ARG_TYPE(0, cmd_binary))
//{
// ARG_MUST_BE_OF_TYPE(1, cmd_binary);
// //TODO really too slow
// integer_t first = getb();
// putb(getb() - first);
//}
//else
// ERR_CONTEXT(ret_bad_operand_type);
}
void mul()
{
2017-04-17 23:10:53 +02:00
//TODO
//// float
//if (IS_ARG_TYPE(0, cmd_number))
//{
// ARG_MUST_BE_OF_TYPE(1, cmd_number);
// //TODO really too slow
// putf(getf() * getf());
//}
//// binary
//else if (IS_ARG_TYPE(0, cmd_binary))
//{
// ARG_MUST_BE_OF_TYPE(1, cmd_binary);
// //TODO really too slow
// putb(getb() * getb());
//}
//else
// ERR_CONTEXT(ret_bad_operand_type);
}
void div()
{
2017-04-17 23:10:53 +02:00
//TODO
//MIN_ARGUMENTS(2);
//// float
//if (IS_ARG_TYPE(0, cmd_number))
//{
// ARG_MUST_BE_OF_TYPE(1, cmd_number);
// //TODO really too slow
// floating_t first = getf();
// // arithmetic faults are managed by c++
// putf(getf() / first);
//}
//// binary
//else if (IS_ARG_TYPE(0, cmd_binary))
//{
// ARG_MUST_BE_OF_TYPE(1, cmd_binary);
// if (((binary*)_stack->get_obj(0))->_value == 0)
// {
// ERR_CONTEXT(ret_div_by_zero);
// }
// else
// {
// //TODO really too slow
// integer_t first = getb();
// putb(getb() / first);
// }
//}
//else
// ERR_CONTEXT(ret_bad_operand_type);
}
void neg()
{
2017-04-17 23:10:53 +02:00
//TODO
//MIN_ARGUMENTS(1);
//// float
//if (IS_ARG_TYPE(0, cmd_number))
// putf(-getf());
//// binary
//else if (IS_ARG_TYPE(0, cmd_binary))
// putb(-getb());
//else
// ERR_CONTEXT(ret_bad_operand_type);
}
void inv()
{
2017-04-17 23:10:53 +02:00
//TODO
//MIN_ARGUMENTS(1);
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
2017-04-17 23:10:53 +02:00
//// arithmetic faults are managed by c++
//putf(1 / getf());
}
void purcent()
{
2017-04-17 23:10:53 +02:00
//TODO
//MIN_ARGUMENTS(2);
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
//ARG_MUST_BE_OF_TYPE(1, cmd_number);
2017-04-17 23:10:53 +02:00
//putf((getf() * getf()) / 100);
}
void purcentCH()
{
2017-04-17 23:10:53 +02:00
//TODO
//MIN_ARGUMENTS(2);
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
//ARG_MUST_BE_OF_TYPE(1, cmd_number);
2017-04-17 23:10:53 +02:00
//// arithmetic faults are managed by c++
//floating_t first = getf();
//putf((100 * first) / getf());
}
void power()
{
2017-04-17 23:10:53 +02:00
//TODO
//MIN_ARGUMENTS(2);
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
//ARG_MUST_BE_OF_TYPE(1, cmd_number);
2017-04-17 23:10:53 +02:00
//// arithmetic faults are managed by c++
//floating_t first = getf();
//putf(powl(getf(), first));
}
void squareroot()
{
2017-04-17 23:10:53 +02:00
//TODO
//MIN_ARGUMENTS(1);
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
2017-04-17 23:10:53 +02:00
//// arithmetic faults are managed by c++
//putf(sqrtl(getf()));
}
void square()
{
2017-04-17 23:10:53 +02:00
//TODO
//MIN_ARGUMENTS(1);
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
2017-04-17 23:10:53 +02:00
//floating_t first = getf();
//putf(first * first);
}
void modulo()
{
2017-04-17 23:10:53 +02:00
//TODO
//MIN_ARGUMENTS(2);
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
//ARG_MUST_BE_OF_TYPE(1, cmd_number);
2017-04-17 23:10:53 +02:00
//// arithmetic faults are managed by c++
//floating_t first = getf();
//putf(fmodl(getf(), first));
}