c++/10566: simple, but big problem

ftomaz@ualg.pt ftomaz@ualg.pt
Wed Apr 30 15:36:00 GMT 2003


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



More information about the Gcc-prs mailing list