public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10566: simple, but big problem
@ 2003-04-30 15:36 ftomaz
0 siblings, 0 replies; 2+ messages in thread
From: ftomaz @ 2003-04-30 15:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 10566
>Category: c++
>Synopsis: simple, but big problem
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Wed Apr 30 15:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: ftomaz@ualg.pt
>Release: gcc (GCC) 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)
>Organization:
>Environment:
Linux Mandrake 9.1 (final)
>Description:
See the output of both lines of code:
1) Bad
cout << (double) floor ( double ( 8.075 * 100 + 0.5 ) ) << endl;
it outputs 807, but (8.075 * 100 + 0.5) = 808. Using this argument in the same code it is good (see below)
2) Ok
cout << (double) floor ( double ( 808 ) ) << endl;
it outputs 808 ... no comments ...
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/10566: simple, but big problem
@ 2003-04-30 15:57 lerdsuwa
0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2003-04-30 15:57 UTC (permalink / raw)
To: ftomaz, gcc-bugs, gcc-prs, nobody
Synopsis: simple, but big problem
State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Wed Apr 30 15:57:34 2003
State-Changed-Why:
Not a bug. Check out:
http://gcc.gnu.org/bugs.html#nonbugs
under the section Problems with floating point
computations. Here 8.075 is actually stored
as 8.0749999...
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10566
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-04-30 15:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-30 15:36 c++/10566: simple, but big problem ftomaz
2003-04-30 15:57 lerdsuwa
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).