By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,617 Members | 1,792 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,617 IT Pros & Developers. It's quick & easy.

Rounding/truncating numbers across Windows, Linux, Solaris

P: 1
I am currently working on an application that runs on Windows XP SP2 with .NET 2.0, Linux 2.4.19-16mdkenterprise and Solaris 5.9. The language is C++.

When I compare the output numbers, Windows rounds the numbers up (for example: 13030.65 becomes 13030.7 - precision is 6) and in Linux/Solaris the number is rounded down or more likely truncated (for example: 13030.65 becomes 13030.6).

I can set the precision on the ostream or output file so that the numbers output the same, however, I would like to know of a way to have each platform round the numbers the same.

Is there is a magic bit or some way to make each platform behave the same when rounding/truncating numbers?
Jan 24 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 3,235
Could you post the code which is creating the numbers, noting all places where you assume rounding is occurring?
Jan 24 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.