Fixed bug introduced in 985d7423.

If a float smaller than one in absolute value is written without a
leading zero in the mod file, for instance as `.5`, we really need to
prefix the number with a zero. The simplest approach is to convert
the strings representing the numerical constants into floats.
parent 985d7423
Pipeline #3010 passed with stages
in 3 minutes and 30 seconds
......@@ -451,7 +451,7 @@ void
NumConstNode::writeJsonAST(ostream &output) const
output << R"({"node_type" : "NumConstNode", "value" : )";
output << datatree.num_constants.get(id) << "}";
output << std::stof(datatree.num_constants.get(id)) << "}";
  • Note that there is no need to use the std:: prefix here, because we are already importing that namespace (through a using namespace std; statement in some header file(s)).

Please register or sign in to reply
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment