https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110860
--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> --- Oh dear, I should stop trying to do so many things at once. I did consider using __v < some_constant because we only need that code for large values, not for 0 and not for anything less than 1. We could maybe use numeric_limits<Fp>::digits10 or something like that. Your approach looks good though. I'm not sure if frexpf and frexpl are universally supported on all targets we care about, but maybe they're present on all targets where our std::to_chars is enabled.