Skip to content
Snippets Groups Projects
Commit 559341b5 authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

libstdc++: Avoid problematic use of log10 in std::format [PR110860]


If abs(__v) is smaller than one, the result will be of the
form 0.xxxxx. It is only if the magnitude is large that more digits
are needed before the decimal dot.

This uses frexp instead of log10 which should be less expensive
and have sufficient precision for the desired purpose.

It removes the problematic cases where log10 will be negative or not
fit in an int.

Signed-off-by: default avatarPaul Dreik <gccpatches@pauldreik.se>

libstdc++-v3/ChangeLog:

	PR libstdc++/110860
	* include/std/format (__formatter_fp::format): Use frexp instead
	of log10.

(cherry picked from commit 2d2b05f0)
parent 8f82863d
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment