yaml-cpp icon indicating copy to clipboard operation
yaml-cpp copied to clipboard

Node double assignment and as<double> error.

Open aaatthework opened this issue 2 months ago • 2 comments

I am setting a node with "1663.1234567891011". After that I am calling it using as. As a result I am getting "0.000450628205" instead of "1663.1234567891011".

Example code is given below.

int main() {
    YAML::Node node;
    double val = 1663.1234567891011;

    node["my_val"] = val;

    std::cout << "Value read:    " << node["my_val"].as<double>() << "\n";

    return 0;
}

Output:

Value read:    0.000450628

aaatthework avatar Nov 10 '25 09:11 aaatthework