[comp.sys.mac.programmer] Bug in MPW C++ ?

chi@cit-vax.Caltech.Edu (Curt Hagenlocher) (03/18/90)

In the course of using MPW C++, I've come across the following problem.

The program

#include <strstream.h>

void main() {
float mypi;
istrstream("3.14159") >> mypi;
cout << "My pi = " << mypi << "!\n" << flush;
}

generates

My pi = 1.xxxxxE-38!

or something similar (I can't remember the exact value).
Interestingly enough, when I use double mypi, the
program works fine.  As it is, I just changed the variable
to double to avoid the problem.

Is this a known bug?  Do I have my head up my ass about something?
I haven't played much with this problem (other than to change the
float to a double), but it seems that it should work.

--
...!ames!elroy!cit-vax!chi       Curt Hagenlocher       chi@cit-vax.caltech.edu
"You can't tell me anything about South Africa, Mozambique, Angola, or
 anywhere and make me believe you're sincere as long as you keep quiet
 about what the United States is doing to us in that country." -- Malcom X