open-discussion > RE: hex output for floats
Jul 20, 2017  02:07 PM | Martin Styner
RE: hex output for floats
My guess is that it's due to your linux distribution, as different distributions have slightly different kernels and system libraries. We usually use scientific linux, which is built on CentOS, and also compile our distributions on that platform (not sure what Slicer uses for its compilation of the extensions).

In this case, it's likely a c++ library difference. 
But, in the code the formate info for the output is not well chosen:
" << std::setw(9) << std::setiosflags(std::ios::fixed) << std::setprecision(17) << std::setiosflags( std::ios::right | std::ios::scientific )"

setw and setprecision should be aligned, particularly if one chooses a fixed notation (setw should be larger than setprecision). And if one choses a fixed notation, then one should not use scientific. So this is clearly not good programming on our end. 

The best seems to replace this with a fixed notation at the higher precision (probably too high with 17), i.e. 
" << std::setw(19) << std::setiosflags(std::ios::fixed) << std::setprecision(17) << std::setiosflags( std::ios::right)"

I'll add that as an issue to change for the next release (which though may take a while to do).

Martin

Threaded View

TitleAuthorDate
Chr. Roßmanith Jul 14, 2017
Martin Styner Jul 14, 2017
Chr. Roßmanith Jul 14, 2017
Martin Styner Jul 14, 2017
Chr. Roßmanith Jul 19, 2017
RE: hex output for floats
Martin Styner Jul 20, 2017