randint.h
1.37 KB
#ifndef POINCARE_RANDINT_H
#define POINCARE_RANDINT_H
#include <poincare/static_hierarchy.h>
#include <poincare/layout_engine.h>
namespace Poincare {
class Randint : public StaticHierarchy<2> {
using StaticHierarchy<2>::StaticHierarchy;
public:
Type type() const override;
Expression * clone() const override;
private:
/* Layout */
ExpressionLayout * createLayout(PrintFloat::Mode floatDisplayMode, int numberOfSignificantDigits) const override {
return LayoutEngine::createPrefixLayout(this, floatDisplayMode, numberOfSignificantDigits, name());
}
int writeTextInBuffer(char * buffer, int bufferSize, PrintFloat::Mode floatDisplayMode, int numberOfSignificantDigits) const override {
return LayoutEngine::writePrefixExpressionTextInBuffer(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, name());
}
const char * name() const { return "randint"; }
/* Evaluation */
Evaluation<float> * privateApproximate(SinglePrecision p, Context& context, AngleUnit angleUnit) const override {
return templateApproximate<float>(context, angleUnit);
}
Evaluation<double> * privateApproximate(DoublePrecision p, Context& context, AngleUnit angleUnit) const override {
return templateApproximate<double>(context, angleUnit);
}
template <typename T> Evaluation<T> * templateApproximate(Context& context, AngleUnit angleUnit) const;
};
}
#endif