This is the mail archive of the gcc-help@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]

Data read incorrectly, by changing compiler's version.


I used  following simple program  on RedHat  7.1 with g++  2.96, which
gave correct result, for data file  having value near "inf" with large
number of significant digits.

But same program  on g++ 3.2 (RedHat 8.0)  gave incorrect result. Even
to  compile,  I  need  to  change  "endl" to  "\n"  and  have  to  use
"-Wno-deprecated" option.

Can some one point out mistake?

-- 
H.S.Rai

=====================================================
Data file
=====================================================
1.797693134862316E+308		50
100

=====================================================
Result from g++ 2.96 on RedHat 7.1
=====================================================
inf
50
100

=====================================================
Results from: g++ 3.2 on RedHat 8.0
=====================================================
2.00102e+10
4.85543e-270
2.00102e+10

=====================================================
Program
=====================================================

#include <fstream.h>
ifstream fin("m.in");
ofstream fout("m.out");

int main()
{

double a, b, c;
fin >> a >> b >> c;
fout << a << endl << b << endl << c << endl;
return 0 ;

}

=====================================================
end of mail.



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