mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] fcvt(99.99, 1, ...) appears to be broken because of varying rounding
@ 2022-09-06 21:13 Gabriel Ravier
  0 siblings, 0 replies; only message in thread
From: Gabriel Ravier @ 2022-09-06 21:13 UTC (permalink / raw)
  To: musl

fcvt(99.99, 1, &decpt, &sign) results in musl returning "9999". I am 
pretty sure the standard ensures that regardless of how the rounding is 
done, only "999" and "1000" are supposed to be valid results for fcvt in 
this situation.

I'd like to add that this seems to occur because of a difference in 
rounding that occurs between the calls to sprintf in fcvt and ecvt, with 
fcvt's call of it returning "100.0" and ecvt's call returning 
"9.999e+01" (i.e. fcvt asked ecvt for 4 significant digits assuming it 
would return "1000" but it ended up getting a contradicting result from 
its call to printf)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-06 21:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06 21:13 [musl] fcvt(99.99, 1, ...) appears to be broken because of varying rounding Gabriel Ravier

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).