public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/29556] New: ecvt(999999999999.9, 3, ...) is broken
@ 2022-09-08 8:17 gabravier at gmail dot com
2022-09-08 8:18 ` [Bug math/29556] " gabravier at gmail dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: gabravier at gmail dot com @ 2022-09-08 8:17 UTC (permalink / raw)
To: glibc-bugs
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug math/29556] ecvt(999999999999.9, 3, ...) is broken
2022-09-08 8:17 [Bug math/29556] New: ecvt(999999999999.9, 3, ...) is broken gabravier at gmail dot com
@ 2022-09-08 8:18 ` gabravier at gmail dot com
2022-09-08 8:20 ` [Bug math/29556] ecvt rounding in edge-cases " gabravier at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: gabravier at gmail dot com @ 2022-09-08 8:18 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29556
Gabriel Ravier <gabravier at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unspecified |2.36
Keywords| |std-posix
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug math/29556] ecvt rounding in edge-cases is broken
2022-09-08 8:17 [Bug math/29556] New: ecvt(999999999999.9, 3, ...) is broken gabravier at gmail dot com
2022-09-08 8:18 ` [Bug math/29556] " gabravier at gmail dot com
@ 2022-09-08 8:20 ` gabravier at gmail dot com
2022-09-08 8:21 ` gabravier at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: gabravier at gmail dot com @ 2022-09-08 8:20 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29556
Gabriel Ravier <gabravier at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ecvt(999999999999.9, 3, |ecvt rounding in edge-cases
|...) is broken |is broken
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug math/29556] ecvt rounding in edge-cases is broken
2022-09-08 8:17 [Bug math/29556] New: ecvt(999999999999.9, 3, ...) is broken gabravier at gmail dot com
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
4 siblings, 0 replies; 6+ messages in thread
From: gabravier at gmail dot com @ 2022-09-08 8:21 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29556
--- Comment #1 from Gabriel Ravier <gabravier at gmail dot com> ---
PS: I've tested this on:
- the original BSD implementation of ecvt
- Cosmopolitan's ecvt
- musl's ecvt (which happens to have the same issue as glibc but in fcvt
instead :p)
- OpenBSD's ecvt
- Windows's ecvt
- ReactOS's ecvt
- UNIX v10's ecvt
- Illumos's ecvt
- ELKS's ecvt
and they all returned either 100 or 999
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug math/29556] ecvt rounding in edge-cases is broken
2022-09-08 8:17 [Bug math/29556] New: ecvt(999999999999.9, 3, ...) is broken gabravier at gmail dot com
` (2 preceding siblings ...)
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
4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2022-09-08 10:04 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29556
--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
fcvt (9.999999999999, 2,,) has the same problem, that is what ecvt eventually
calls.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug math/29556] ecvt rounding in edge-cases is broken
2022-09-08 8:17 [Bug math/29556] New: ecvt(999999999999.9, 3, ...) is broken gabravier at gmail dot com
` (3 preceding siblings ...)
2022-09-08 10:04 ` schwab@linux-m68k.org
@ 2022-09-08 12:35 ` gabravier at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: gabravier at gmail dot com @ 2022-09-08 12:35 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29556
--- Comment #3 from Gabriel Ravier <gabravier at gmail dot com> ---
Hmmmm, I'm not sure fcvt's behavior is by itself a bug, as POSIX leaves the
rounding behavior of `fcvt` implementation-defined.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-09-08 12:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08 8:17 [Bug math/29556] New: ecvt(999999999999.9, 3, ...) is broken gabravier at gmail dot com
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
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).