public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gabravier at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug math/29556] New: ecvt(999999999999.9, 3, ...) is broken
Date: Thu, 08 Sep 2022 08:17:13 +0000	[thread overview]
Message-ID: <bug-29556-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29556

            Bug ID: 29556
           Summary: ecvt(999999999999.9, 3, ...) is broken
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int main()
{
    int decpt, sign;
    char *result = ecvt(999999999999.9, 3, &decpt, &sign);

    printf("ecvt(999999999999.9, 3, &[%d], &[%d]) = '%s'\n", decpt, sign,
result);
}

I believe the following program should output either:

ecvt(999999999999.9, 3, &[13], &[0]) = '100'

or:

ecvt(999999999999.9, 3, &[12], &[0]) = '999'

glibc instead outputs this:

ecvt(999999999999.9, 3, &[13], &[0]) = '1000'

which seems like it can't possibly be correct considering the call explicitly
asked for 3 characters to be printed.

PS: This seems to be caused by different in rounding between what `ecvt`
determines and what `fcvt` determines in the inner call to it by `ecvt`

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-09-08  8:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08  8:17 gabravier at gmail dot com [this message]
2022-09-08  8:18 ` [Bug math/29556] " gabravier at gmail dot com
2022-09-08  8:20 ` [Bug math/29556] ecvt rounding in edge-cases " gabravier at gmail dot com
2022-09-08  8:21 ` gabravier at gmail dot com
2022-09-08 10:04 ` schwab@linux-m68k.org
2022-09-08 12:35 ` gabravier at gmail dot com

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=bug-29556-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).