Merge pull request #2462 from joakim-hove/keyword-generator-default-precision

Make sure precision is retained in very small default values

Closes #2448
This commit is contained in:
Bård Skaflestad 2021-05-07 12:45:16 +02:00 committed by GitHub
commit 65dc2e0942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -652,11 +652,11 @@ std::string ParserItem::inlineClassInit(const std::string& parentClass,
case type_tag::integer:
return std::to_string( this->getDefault< int >() );
case type_tag::fdouble:
return std::to_string( this->getDefault< double >() );
return as_string( this->getDefault< double >() );
case type_tag::uda:
{
double value = this->getDefault<UDAValue>().get<double>();
return "UDAValue(" + std::to_string(value) + ")";
return "UDAValue(" + as_string(value) + ")";
}
case type_tag::string:
return "\"" + this->getDefault< std::string >() + "\"";

View File

@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(TuningTest) {
BOOST_CHECK_CLOSE(TRGCNV_default, 0.001, diff);
double TRGMBE_default = tuning.TRGMBE;
BOOST_CHECK_CLOSE(TRGMBE_default, 0.0, diff);
BOOST_CHECK_CLOSE(TRGMBE_default, 1e-7, diff);
double TRGLCV_default = tuning.TRGLCV;
BOOST_CHECK_CLOSE(TRGLCV_default, 0.0001, diff);