[Bug 33254] New: sprintf doesn't respect _set_output_format for E format

wine-bugs at winehq.org wine-bugs at winehq.org
Thu Mar 21 05:43:14 CDT 2013


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 at winehq.org
        ReportedBy: sebastian.wolff at 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.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list