Menu

#137 malformed output and/or crashes when using hexfloat

v1.0 (example)
open
nobody
None
5
2018-05-31
2018-05-31
No

The following program crashes when compiled and run in MinGW (it displays the "a.exe has stopped working" Windows dialogue):

#include <iostream>
using namespace std;

int main() {
    double pi{3.1415926535};
    cout << hexfloat << pi << endl;
}

The following program produces the output 2e-081:

#include <iostream>
using namespace std;

int main() {
    cout << hexfloat << 100.0 << endl;
}

Adding the line

#define USE_MINGW_ANSI_STDIO 1

makes no difference, except for a compiler warning that the symbol is already defined.

This is with version 6.3.0-1 of MinGW and gcc 6.3.0, using --std=c++11 on Windows 7.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB