home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.aix
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!merrick
- From: merrick@magnus.acs.ohio-state.edu (Tom Merrick)
- Subject: Re: xlC++ Severe Compiler Error
- Message-ID: <1993Jan25.130222.3387@magnus.acs.ohio-state.edu>
- Sender: news@magnus.acs.ohio-state.edu
- Nntp-Posting-Host: bottom.magnus.acs.ohio-state.edu
- Organization: The Ohio State University
- References: <19930122.052714.669@almaden.ibm.com>
- Date: Mon, 25 Jan 1993 13:02:22 GMT
- Lines: 99
-
- In article <19930122.052714.669@almaden.ibm.com> kraemerf@franvm3.VNET.IBM.COM writes:
- >.
- >
- >One of my customers (University of Kassel) send me the following
- >small C++ program and complained that the xlC++ compiler does
- >not work as it should be. He is running on AIX 3.2.3 level.
- >
- >Yes, I'm the proud owner of a C++ book, bought at Palo Alto
- >in march 1991 - it's a nice looking book but I never touched
- >more than the table of contents with my eyes, but my friends
- >are very impressed.........
- >
- >So the question to the audience is, is this real good C++ style or
- >is our comipler buggy.......
- >
- >
- >> ////////////////////////////////////////////////////
- >>
- >> #include <iostream.h>
- >> void main()
- >> {
- >> double a, b, c, d, e, f, g, h;
- >> a = 0.0;
- >> b = 0.5;
- >> c = 1.0;
- >> d = 1.5;
- >> e = 1.0/2.0;
- >> f = +0.5;
- >> g = 5e-1;
- >> h = 1/2; // this is no mistake, just a well known
- >> // C trick for testing purposes
- >>
- >> cout << "Variations for 1/2 (in C++):\n\n";
- >>
- >> cout << " a = " << a << " should be 0.0 \n";
- >> cout << " b = " << b << " should be 0.5 \n";
- >> cout << " c = " << c << " should be 1.0 \n";
- >> cout << " d = " << d << " should be 1.5 \n";
- >> cout << " e = " << e << " should be 0.5 \n";
- >> cout << " f = " << f << " should be 0.5 \n";
- >> cout << " g = " << g << " should be 0.5 \n";
- >> cout << " h = " << h << " should be 0.0 (!)\n";
- >>
- >> } // main
- >>
- >> ////////////////////////////////////////////////////////
- >>
- >> That's the output:
- >>
- >> Variations for 1/2 (in C++):
- >>
- >> a = 0 should be 0.0
- >> b = 0 should be 0.5
- >> c = 1 should be 1.0
- >> d = 1 should be 1.5
- >> e = 0.5 shoulbe d 0.5
- >> f = 0 should be 0.5
- >> g = 0.5 shoulbe d 0.5
- >> h = 0 should be 0.0 (!)
- >>
- >> ////////////////////////////////////////////////////////
- >
- >thanks for your comments
- >
- >-frank-
- >
- >
- >
- >
- >
- >
- >
- >
- >.----------------------------------------------------------------------.
- >| E-Mail: FRANVM3(KRAEMERF) - IBM VNET "Yes, I'm one |
- >| ====== IBMMAIL(DEIBM27S) - IBM-Mail of those |
- >| DE.IBMX400.IBMMAIL.KRAEMER.KRAEME - X.400 stupid IBM |
- >| kraemerf@franvm3.vnet.ibm.com - Internet field SE's." |
- >| Voice : +49-(0)611/776-364 |
- >| Mail : Abraham-Lincoln Street 26, 6200 Wiesbaden, Germany |
- >'----------------------------------------------------------------------'
-
- With xlC at level 1.1.2 running under aix 3.2.2 I got the following:
- Variations for 1/2 (in C++):
-
- a = 0 should be 0.0
- b = 0.5 should be 0.5
- c = 1 should be 1.0
- d = 1.5 should be 1.5
- e = 0.5 should be 0.5
- f = 0.5 should be 0.5
- g = 0.5 should be 0.5
- h = 0 should be 0.0 (!)
-
- Make sure that you are running the current xlC as the latest release came
- out in late 92.
-
- Tom Merrick
- Ohio State University
-