Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim precision for every functional operation in 2D interpreter #1704

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ void TrikPrintTextBlock::doJob(kitBase::robotModel::robotParts::Display &display
const int x = eval<int>("XCoordinateText");
const int y = eval<int>("YCoordinateText");
const int fontSize = eval<int>("FontSize");
const QString result = boolProperty("Evaluate")
? QString::number(QString::number(eval<qreal>("PrintText"), 'f', 6).toDouble())
: stringProperty("PrintText");
const QString result = boolProperty("Evaluate") ? eval<QString>("PrintText") : stringProperty("PrintText");
const bool redraw = boolProperty("Redraw");

if (!errorsOccured()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ void PrintTextBlock::doJob(kitBase::robotModel::robotParts::Display &display)
{
const int x = eval<int>("XCoordinateText");
const int y = eval<int>("YCoordinateText");
const QString result = boolProperty("Evaluate")
? QString::number(QString::number(eval<qreal>("PrintText"), 'f', 6).toDouble())
: stringProperty("PrintText");
const QString result = boolProperty("Evaluate") ? eval<QString>("PrintText") : stringProperty("PrintText");
const bool redraw = boolProperty("Redraw");

if (!errorsOccured()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ void RobotsBlockParser::addIntrinsicFuctions()
, std::function<qreal(qreal)> const &function)
{
add1aryFunction(name, new types::Float, new types::Float
, [function](const QVariant &arg) { return function(arg.toReal()); });
, [function](const QVariant &arg) {
return QString::number(function(arg.toReal()), 'f').toDouble();
});
};

const auto addIntegerFunction = [add1aryFunction] (const QString &name
Expand Down
Loading