mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 09:40:07 +01:00
- CreateLayout depends on the float display mode and the number of significant digits - Float display mode does not have a default value anymore
42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#include <poincare/undefined.h>
|
|
#include <poincare/layout_engine.h>
|
|
|
|
extern "C" {
|
|
#include <math.h>
|
|
#include <string.h>
|
|
}
|
|
|
|
namespace Poincare {
|
|
|
|
Expression::Type Undefined::type() const {
|
|
return Type::Undefined;
|
|
}
|
|
|
|
Expression * Undefined::clone() const {
|
|
return new Undefined();
|
|
}
|
|
|
|
int Undefined::polynomialDegree(char symbolName) const {
|
|
return -1;
|
|
}
|
|
|
|
template<typename T> Complex<T> * Undefined::templatedApproximate(Context& context, AngleUnit angleUnit) const {
|
|
return new Complex<T>(Complex<T>::Undefined());
|
|
}
|
|
|
|
ExpressionLayout * Undefined::createLayout(PrintFloat::Mode floatDisplayMode, int numberOfSignificantDigits) const {
|
|
char buffer[16];
|
|
int numberOfChars = PrintFloat::convertFloatToText<float>(NAN, buffer, 16, 1, floatDisplayMode);
|
|
return LayoutEngine::createStringLayout(buffer, numberOfChars);
|
|
}
|
|
|
|
int Undefined::writeTextInBuffer(char * buffer, int bufferSize, int numberOfSignificantDigits) const {
|
|
if (bufferSize == 0) {
|
|
return -1;
|
|
}
|
|
return strlcpy(buffer, "undef", bufferSize);
|
|
}
|
|
|
|
}
|
|
|