Skip to content

to_string<float> uses double math and fails with -Werror=float-conversion #1593

Description

@puzrin

With ETL 20.48.1 and GCC 15.2 / ESP-IDF 6.1, etl::to_string<float>(3.14f, output) fails with:

conversion from 'double' to 'float' may change value [-Werror=float-conversion]

In private/to_string_helper.h (lines 350 and 407), ::floor(...) returns double, which is assigned back to float.

Minimal reproducer and run instructions: https://github.com/puzrin/etl-float-repro

Similar float-formatting improvements appear to have been made in #1379 for format.h, but this path in to_string still uses double math.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions