japaric / ufmt

a smaller, faster and panic-free alternative to core::fmt
Apache License 2.0
352 stars 40 forks source link

Add support for float #63

Closed Simsys closed 8 months ago

Simsys commented 9 months ago

This pull request adds support for f32 and f64 numbers. The implementation is kept lean and simple in the spirit of the project. Even with this addition, there is no panic branch when compiling the release version.

The simple implementation leads to deviations from std::format. For example, the maximum number of digits (before and after the decimal point) is limited to 19. Details can be found in tests/vs-std-write.rs.

However, this implementation should be usable for the vast majority of applications.