Article View: gnu.gcc.bug
Article #6156bug report
From: Bernd Fehling
Date: Tue, 19 Nov 1996 00:00
Date: Tue, 19 Nov 1996 00:00
42 lines
1700 bytes
1700 bytes
Hello,
I think I've found a bug.
I'm using gcc 2.7.2 on LINUX and on Solaris.
Here is my testprogramm:
/* --------------------------------------------------- */
#include <stdio.h>
void main()
{
double input = 2.01; /* also with 4.02, 8.04, 16.08, ... */
int result = 0.0;
input = input * 100.0;
result = input;
printf("(Input * 100.0) is: %f, Result is: %d \n", input, result);
}
/* ---------------------------------------------------- */
What I suppose from this program is, that it should give
me the result of 201. But actually I get a result of 200.
This happens also with 4.02 (401), 8.04 (803) and so on.
This also happens, if the value is negative or only the half
of 2.01 (1.005 but then you have to multiply with 1000.0).
This will NOT happen if you make 'input' a float variable.
I tried nearly all different compiler switches, but I couldn't
get rid of this problem.
My opinion is, that this is a problem of the compiler, isn't it?
Please mail me your opinion.
regards
Bernd Fehling EMAIL: befehl@ub.uni-bielefeld.de
Technical Details
Message-ID:
<3291CEEC.777B1579@ub.uni-bielefeld.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,3ae214ded2e93f17,start X-Google-Attributes: gid113d02,public From: befehl@ub.uni-bielefeld.de (Bernd Fehling) Subject: bug report Date: 1996/11/19 Message-ID: <3291CEEC.777B1579@ub.uni-bielefeld.de> X-Deja-AN: 197442130 sender: befehl@ub.uni-bielefeld.de content-type: text/plain; charset=us-ascii organization: University of Bielefeld x-gateway: relay4.UU.NET from bug-gcc to gnu.gcc.bug; Tue, 19 Nov 1996 10:16:01 EST mime-version: 1.0 newsgroups: gnu.gcc.bug x-mailer: Mozilla 3.0 (X11; I; Linux 2.0.24 i586)