http://bugs.winehq.org/show_bug.cgi?id=33254
Bug #: 33254 Summary: sprintf doesn't respect _set_output_format for E format Product: Wine Version: 1.5.26 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt AssignedTo: wine-bugs@winehq.org ReportedBy: sebastian.wolff@dynardo.at Classification: Unclassified
On UNIX systems the printf functions always create an exponent with 2 digits. This is different on Windows, where 3 digits are used for the exponent at least by default. One can, however, justify this default:
#include <stdio.h> #include <iostream>
int main() {
// enforce 2 digits in the exponent of printf() floating point format (Windows uses 3 digits by default, UNIX uses 2) unsigned int old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
char string[80]; int node_id(0); double x(0),y(0),z(0), node_info_1(0), node_info_2(0); int num_written = sprintf(string, "%8d%16.8E%16.8E%16.8E%8d%8d", node_id, x, y, z, node_info_1, node_info_2);
std::cout << string << std::endl;
// restore number of digits in printf floating point format _set_output_format(old_exponent_format); }
On Windows this produces output with 2 digits used for the exponent. On WINE, however, always 3 digits are used.