Files
Upsilon/poincare/src/floor.cpp
Émilie Feral 28b7bca7fc [poincare] Fix bug
Change-Id: I2d860f699e91e91b8ac7c7cbe92ca492736d60e2
2017-03-29 18:36:46 +02:00

36 lines
687 B
C++

#include <poincare/floor.h>
extern "C" {
#include <assert.h>
#include <math.h>
}
namespace Poincare {
Floor::Floor() :
Function("floor")
{
}
Expression::Type Floor::type() const {
return Type::Floor;
}
Expression * Floor::cloneWithDifferentOperands(Expression** newOperands,
int numberOfOperands, bool cloneOperands) const {
assert(newOperands != nullptr);
Floor * f = new Floor();
f->setArgument(newOperands, numberOfOperands, cloneOperands);
return f;
}
float Floor::privateApproximate(Context& context, AngleUnit angleUnit) const {
assert(angleUnit != AngleUnit::Default);
float f = m_args[0]->approximate(context, angleUnit);
return floorf(f);
}
}