mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Gabriel Ravier <gabravier@gmail.com>
To: musl@lists.openwall.com
Subject: [musl] fcvt(99.99, 1, ...) appears to be broken because of varying rounding
Date: Tue, 6 Sep 2022 23:13:26 +0200	[thread overview]
Message-ID: <a0c7cfdc-8d8a-0561-dd35-af569dd9ba9c@gmail.com> (raw)

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)


                 reply	other threads:[~2022-09-06 21:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a0c7cfdc-8d8a-0561-dd35-af569dd9ba9c@gmail.com \
    --to=gabravier@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).