471,343 Members | 1,434 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,343 software developers and data experts.

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 1986
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.