×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Print decimal notation differences under linux and windows

Print decimal notation differences under linux and windows

Print decimal notation differences under linux and windows

(OP)
Hey, Hope this question is cool for this forum.
I have a large model that i'm testing under linux and windows. To check the output files i want to simply be able to do a file compare.

Unfortunately printf("%e\n", value), where value = 1.0  results in different output formats under linux and windows.
Windows produces 1.000000e+000
and linux produces 1.000000e+00

As you can see windows displays three values after the e while linux displays 2.

Does anyone know how i can control this?

yeah i could write a hack to convert the output files before comparing them but it would be cool to not have to do that.

Thanks for any help in advance.

RE: Print decimal notation differences under linux and windows

That's not all you have to deal with.
http://en.wikipedia.org/wiki/Floating_point

Floats are approximations, and you're likely to find all sorts of very minor differences which are going to result in differences in the output.

--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close