Computer Chess Club Archives


Search

Terms

Messages

Subject: [Off Topic] Rounding errors

Author: macaroni

Date: 17:17:15 11/25/04


If I have a piece of c++ code like:

double x = 2000;
double y = 2.000002;
cout << x-y << "\n";


will display 1998. Is there a way I can avoid this rounding problem?
any help much appreciated.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.