Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print decimal notation differences under linux and windows

Status
Not open for further replies.

Bece

Programmer
May 22, 2008
1
AU
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.
 
That's not all you have to deal with.

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top