468,733 Members | 1,412 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,733 developers. It's quick & easy.

Rounding/truncating numbers across Windows, Linux, Solaris

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
1 1882
Motoma
3,237 Expert 2GB
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.

Similar topics

reply views Thread by Danny Winslow | last post: by
1 post views Thread by Dr John Stockton | last post: by
4 posts views Thread by Kelly Mah | last post: by
6 posts views Thread by cj | last post: by
9 posts views Thread by Joe Attardi | last post: by
5 posts views Thread by soeren | last post: by
30 posts views Thread by bdsatish | last post: by
reply views Thread by zhoujie | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.