g++-2.7.2p - BIG floating point problem!

g++-2.7.2p - BIG floating point problem!

Post by Michael N. Goldshte » Tue, 12 Mar 1996 04:00:00



I just upgraded everything C++-compiler related to the latest and
greatest stuff on sunsite (i.e. gcc 2.7.2p libc-5.2.18 libg++-2.7.1.3)
and am experiencing a problem display floating point values. Here is a
sample program:

-----------------------------------------------------------------------
// tester.cpp - Finds apparent bug in g++ compiler/libs
//              Note, although only one number is shown (i.e. 57.0)
//              this happens for any floating point number
// Evironment:
// gcc-2.7.2p, libc-5.2.18, libg++-2.7.1.3 (all from sunsite binaries)
// Machine is a Pentium-133 running kernel linuxelf-1.2.13

#include <iostream.h>

main()
{
  cout << "This works:" << endl;
  cout << (long double) 57.0 << endl;
  cout << "This doesn't (may be expecting a long double?!)" << endl;
  cout << (double) 57.0 << endl;
  cout << "This doesn't (may be expecting a long double?!)" << endl;
  cout << (float) 57.0 << endl;

Quote:}

-----------------------------------------------------------------------
Output, after 'g++ -o tester tester.cpp'

This works:
 57.0000
This doesn't (may be expecting a long double?!)
-1.49226e-4217
This doesn't (may be expecting a long double?!)
-1.24570e-2194

-----------------------------------------------------------------------

 
 
 

g++-2.7.2p - BIG floating point problem!

Post by Ronald Wah » Wed, 13 Mar 1996 04:00:00



Quote:> I just upgraded everything C++-compiler related to the latest and
> greatest stuff on sunsite (i.e. gcc 2.7.2p libc-5.2.18 libg++-2.7.1.3)
> and am experiencing a problem display floating point values. Here is a
> sample program:
> [...]
> Output, after 'g++ -o tester tester.cpp'

> This works:
>  57.0000
> This doesn't (may be expecting a long double?!)
> -1.49226e-4217
> This doesn't (may be expecting a long double?!)
> -1.24570e-2194

I got the following (gcc-2.7.2 and gcc-2.7.2p-pl8, libc-5.2.18, libg++-2.7.1.3)

This works:
57
This doesn't (may be expecting a long double?!)
57
This doesn't (may be expecting a long double?!)
57

cu,
ron

--

 \ WWW: http://www.tu-chemnitz.de/~row             \

   \ PGP key available by finger to my email address \

 
 
 

1. g++-2.7.2p - BIG floating point problem!

I just upgraded everything C++-compiler related to the latest and
greatest stuff on sunsite (i.e. gcc 2.7.2p libc-5.2.18 libg++-2.7.1.3)
and am experiencing a problem display floating point values. Here is a
sample program:

-----------------------------------------------------------------------
// tester.cpp - Finds apparent bug in g++ compiler/libs
//              Note, although only one number is shown (i.e. 57.0)
//              this happens for any floating point number
// Evironment:
// gcc-2.7.2p, libc-5.2.18, libg++-2.7.1.3 (all from sunsite binaries)
// Machine is a Pentium-133 running kernel linuxelf-1.2.13

#include <iostream.h>

main()
{
  cout << "This works:" << endl;
  cout << (long double) 57.0 << endl;
  cout << "This doesn't (may be expecting a long double?!)" << endl;
  cout << (double) 57.0 << endl;
  cout << "This doesn't (may be expecting a long double?!)" << endl;
  cout << (float) 57.0 << endl;
-----------------------------------------------------------------------
Output, after 'g++ -o tester tester.cpp'

This works:
 57.0000
This doesn't (may be expecting a long double?!)
-1.49226e-4217
This doesn't (may be expecting a long double?!)
-1.24570e-2194

-----------------------------------------------------------------------

2. BSD Security Holes

3. Question about dmesg

4. How to get identd to work behind NAT?

5. Problem with libg++-2.7.2.1

6. networking/remote X are SLOW. Help please!

7. libg++-2.7.2.7

8. g++-2.7.2 and Openserver 5

9. Nan and floating point related problems

10. libg++-2.7.2.8 setup - help??

11. Where to download libg++-2.7.2 source?