Skip to content

【bug】 tools.cpp-num_fractions_from_double_type #77

@tianjixuetu

Description

@tianjixuetu
std::size_t num_fractions_from_double_type(const double_type &v) {
        if (v == 1) return 1u;

        double_type r{v};
        std::size_t n = 0u;
        for (; r != 1; ++n) {
            r *= 10;
        }

        return n;
}

in the code, r!=1, it makes the for loop will continue forever if v!=1;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions