1 #include <fridh/symbol.hpp>
5 #define NUMERIC_COMPARISON(name, description, operator) \
6 void variable::name(variable const & argument, variable & output) const \
8 if(is_numeric_type() && argument.is_numeric_type()) \
10 if(is_floating_point_operation(argument)) \
11 output.new_boolean(get_floating_point_value() operator argument.get_floating_point_value()); \
12 else if(type == variable_type_identifier::unsigned_integer && argument.type == variable_type_identifier::signed_integer) \
13 output.new_boolean(unsigned_integer operator argument.unsigned_integer); \
15 output.new_boolean(signed_integer operator argument.signed_integer); \
18 binary_argument_type_error(description, type, argument.type); \
21 NUMERIC_COMPARISON(less_than
, "Less than", <)
22 NUMERIC_COMPARISON(less_than_or_equal
, "Less than", <=)
23 NUMERIC_COMPARISON(greater_than
, "Less than", >)
24 NUMERIC_COMPARISON(greater_than_or_equal
, "Less than", >=)
26 void variable::not_equal(variable
const & argument
, variable
& output
) const
28 output
.new_boolean(operator!=(argument
));
31 void variable::equal(variable
const & argument
, variable
& output
) const
33 output
.new_boolean(operator==(argument
));
36 void variable::logical_not(variable
& output
) const
38 output
.new_boolean(!get_boolean_value());