| www.delorie.com/archives/browse.cgi | search | 
| From: | Victor Senderov <victor DOT bg AT usa DOT net> | 
| Newsgroups: | comp.os.msdos.djgpp | 
| Subject: | Problem with floats | 
| Date: | Sun, 07 Mar 1999 20:26:17 -0500 | 
| Organization: | Posted via RemarQ, http://www.remarQ.com - Discussions start here! | 
| Lines: | 20 | 
| Message-ID: | <36E32739.E6E9AFA0@usa.net> | 
| NNTP-Posting-Host: | 209.141.73.41 | 
| Mime-Version: | 1.0 | 
| X-Trace: | 920856390 FQHDYQB2I4929D18DC usenet80.supernews.com | 
| X-Complaints-To: | newsabuse AT remarQ DOT com | 
| X-Mailer: | Mozilla 4.05 [en] (Win95; I) | 
| To: | djgpp AT delorie DOT com | 
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp | 
| Reply-To: | djgpp AT delorie DOT com | 
 Hi,
I wrote a test a program in order to see how djgpp will display a float
and was puzzled by the following:
#include <iomanip.h>
#include <iostream.h>
int main()
{
 cout << setprecision(25);
 double test = 37000.95000;
 cout << test;
 return 0;
}
Output : 37000.94999999999708961695
Can anybody explain why it outputs something so incorrect? Also, I
compiled this under other compiler and it worked ok -- the other
compiler displayed 37000.95
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |