This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/10566: simple, but big problem


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]