xo-reader2 stack: + xo-numeric + setup multi dispatch for *,/
This commit is contained in:
parent
070d333a07
commit
d6bf210714
37 changed files with 1057 additions and 83 deletions
48
xo-numeric/src/numeric/FloatIntegerOps.cpp
Normal file
48
xo-numeric/src/numeric/FloatIntegerOps.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/** @file FloatIntegerOps.cp
|
||||
*
|
||||
* @author Roland Conybeare, Feb 2206
|
||||
**/
|
||||
|
||||
#include "FloatIntegerOps.hpp"
|
||||
#include "float/INumeric_DFloat.hpp"
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::AGCObject;
|
||||
|
||||
namespace scm {
|
||||
|
||||
// ----- Float op Integer -----
|
||||
|
||||
obj<AGCObject>
|
||||
FloatIntegerOps::multiply(obj<ARuntimeContext> rcx,
|
||||
DFloat * x, DInteger * y)
|
||||
{
|
||||
return DFloat::box<AGCObject>(rcx.allocator(), x->value() * y->value());
|
||||
}
|
||||
|
||||
obj<AGCObject>
|
||||
FloatIntegerOps::divide(obj<ARuntimeContext> rcx,
|
||||
DFloat * x, DInteger * y)
|
||||
{
|
||||
return DFloat::box<AGCObject>(rcx.allocator(), x->value() / y->value());
|
||||
}
|
||||
|
||||
// ----- Integer op Float -----
|
||||
|
||||
obj<AGCObject>
|
||||
IntegerFloatOps::multiply(obj<ARuntimeContext> rcx,
|
||||
DInteger * x, DFloat * y)
|
||||
{
|
||||
return DFloat::box<AGCObject>(rcx.allocator(), x->value() * y->value());
|
||||
}
|
||||
|
||||
obj<AGCObject>
|
||||
IntegerFloatOps::divide(obj<ARuntimeContext> rcx,
|
||||
DInteger * x, DFloat * y)
|
||||
{
|
||||
return DFloat::box<AGCObject>(rcx.allocator(), x->value() / y->value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* end FloatIntegerOps.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue