/** @file FloatIntegerOps.cp * * @author Roland Conybeare, Feb 2206 **/ #include "FloatIntegerOps.hpp" #include "float/INumeric_DFloat.hpp" #include namespace xo { using xo::mm::AGCObject; namespace scm { // ----- Float op Integer ----- obj FloatIntegerOps::multiply(obj rcx, DFloat * x, DInteger * y) { return DFloat::box(rcx.allocator(), x->value() * y->value()); } obj FloatIntegerOps::divide(obj rcx, DFloat * x, DInteger * y) { return DFloat::box(rcx.allocator(), x->value() / y->value()); } obj FloatIntegerOps::add(obj rcx, DFloat * x, DInteger * y) { return DFloat::box(rcx.allocator(), x->value() + y->value()); } obj FloatIntegerOps::subtract(obj rcx, DFloat * x, DInteger * y) { return DFloat::box(rcx.allocator(), x->value() - y->value()); } obj FloatIntegerOps::cmp_equal(obj rcx, DFloat * x, DInteger * y) { return DBoolean::box(rcx.allocator(), x->value() == DFloat::value_type(y->value())); } obj FloatIntegerOps::cmp_notequal(obj rcx, DFloat * x, DInteger * y) { return DBoolean::box(rcx.allocator(), x->value() != DFloat::value_type(y->value())); } obj FloatIntegerOps::cmp_less(obj rcx, DFloat * x, DInteger * y) { return DBoolean::box(rcx.allocator(), x->value() < DFloat::value_type(y->value())); } // ----- Integer op Float ----- obj IntegerFloatOps::multiply(obj rcx, DInteger * x, DFloat * y) { return DFloat::box(rcx.allocator(), x->value() * y->value()); } obj IntegerFloatOps::divide(obj rcx, DInteger * x, DFloat * y) { return DFloat::box(rcx.allocator(), x->value() / y->value()); } obj IntegerFloatOps::add(obj rcx, DInteger * x, DFloat * y) { return DFloat::box(rcx.allocator(), x->value() + y->value()); } obj IntegerFloatOps::subtract(obj rcx, DInteger * x, DFloat * y) { return DFloat::box(rcx.allocator(), x->value() - y->value()); } obj IntegerFloatOps::cmp_equal(obj rcx, DInteger * x, DFloat * y) { return DBoolean::box(rcx.allocator(), DFloat::value_type(x->value()) == y->value()); } obj IntegerFloatOps::cmp_notequal(obj rcx, DInteger * x, DFloat * y) { return DBoolean::box(rcx.allocator(), DFloat::value_type(x->value()) != y->value()); } obj IntegerFloatOps::cmp_less(obj rcx, DInteger * x, DFloat * y) { return DBoolean::box(rcx.allocator(), DFloat::value_type(x->value()) < y->value()); } } } /* end FloatIntegerOps.cpp */