Commit 8d08b233 authored by Victor Yacovlev's avatar Victor Yacovlev

Real sprint made possible to Zero-values on digits-after-dot count

parent 633302cd
......@@ -2089,7 +2089,7 @@ void SyntaxAnalizer::parseOutput(int str)
expr3->baseType.kind = AST::TypeInteger;
expr3->dimension = 0;
expr3->kind = AST::ExprConst;
expr3->constant = QVariant(0);
expr3->constant = QVariant(-1);
}
if (expr->baseType.kind==AST::TypeUser) {
bool canConvert = makeCustomUnaryOperation<bool>(lexer_->outputLexemName(), expr, st.mod);
......
......@@ -935,7 +935,7 @@ public:
static String sprintfReal(real value, Char dot, bool expform, int width, int decimals, char al) {
std::stringstream stream;
if (0 == decimals && !expform) {
if (0 > decimals && !expform) {
double absVal = fabs(double(value));
if (0.0 != value && (absVal < 0.0001 || absVal > 999999.))
expform = true;
......@@ -946,7 +946,7 @@ public:
}
else {
stream << std::fixed;
stream.precision(0==decimals ? 6 : decimals);
stream.precision(0>decimals ? 6 : decimals);
}
stream << value;
......@@ -967,7 +967,7 @@ public:
if (std::string::npos != dotPos) {
rpart.replace(dotPos, 1, ".");
}
if ((expform || 0==decimals) && std::string::npos != rpart.find('.')) {
if ((expform || 0>decimals) && std::string::npos != rpart.find('.')) {
while (rpart.size() > 1 && '0' == rpart.at(rpart.size()-1)) {
rpart.resize(rpart.length()-1);
}
......
......@@ -2403,7 +2403,7 @@ void KumirVM::do_store(uint8_t s, uint16_t id)
svalue = Kumir::Converter::sprintfInt(value.toInt(), 10, 0, 0);
}
else if (t==VT_real) {
svalue = Kumir::Converter::sprintfReal(value.toReal(), '.', false, 0 ,0, 0);
svalue = Kumir::Converter::sprintfReal(value.toReal(), '.', false, 0 ,-1, 0);
}
else if (t==VT_bool) {
static const String YES = Kumir::Core::fromUtf8("да");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment