Skip to content

get_value<int>() and get_value<float>() reporting floating point underflow on value 0 #366

@ARessegetesStery

Description

@ARessegetesStery

Description

When querying nodes with value 0, get_value<int>() and get_value<float>() will throw exception with message

Floating point value underflow detected.

It is suspected that a prior check on whether the value is zero should be conducted

Reproduction steps

Use yaml file (e.g. test.yaml)

pos: [0.0, 0.0, 0.0]

and c++ code

std::ifstream ifs("test.yaml");
fkyaml::node root = fkyaml::node::deserialize(ifs);
auto posNode = root["pos"];
float posX = posNode[0].get_value<float>(); // throws exception reporting underflow

Expected vs. actual results

Expected: reading in 0 correctly.
Actual: throwing exception "Floating point value underflow detected."

Minimal code example

No response

Error messages

No response

Compiler and operating system

g++; Windows

Library version

v0.3.8

Validation

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions