View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0000348 | mercury | Bug | public | 2014-07-18 15:07 | 2015-07-08 13:15 | ||||
Reporter | juliensf | ||||||||
Assigned To | juliensf | ||||||||
Priority | normal | Severity | minor | Reproducibility | have not tried | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0000348: Failure of tests/general/string_format_special_floats with MSVC | ||||||||
Description | When using MSVC as a C compiler, the test case tests/general/string_format_special_float fails as the MS libc doesn't appear to implement the C99 behaviour for printing nan, inf etc. With VS2012 we get: Plus Infinity: %e: failure '1.#INF00 %f: failure '1.#INF00 %g: failure '1.#INF' %E: failure '1.#INF00 %F: failure '' %G: failure '1.#INF' Minus Infinity: %e: failure '-1.#INF0 %f: failure '-1.#INF0 %g: failure '-1.#INF' %E: failure '-1.#INF0 %F: failure '' %G: failure '-1.#INF' Not a number: %e: failure '-1.#IND0 %f: failure '-1.#IND0 %g: failure '-1.#IND' %E: failure '-1.#IND0 %F: failure '' %G: failure '-1.#IND' We should probably check for special float values before calling sprintf and just handle them directly using Mercury. (This would also avoid some inconsistencies in the output of these tests due to do differences in C libraries.) | ||||||||
Tags | No tags attached. | ||||||||
Attached Files |
|
Notes | |
juliensf (administrator) 2014-07-18 15:46 |
The same problem also affects tests/hard_coded/write_float_special. |
wangp (developer) 2014-07-18 16:23 |
For what it's worth, NaNs were printed on AIX as "NaNQ", where 'Q' stands for quiet. |
juliensf (administrator) 2014-07-18 17:01 |
C99 says they should be printed as: nan, -nan, nan(...) or -nan(...) where "..." is an implementation-defined sequence of letters, digits or underscores. (Or in uppercase if %F is used.) |
juliensf (administrator) 2014-08-06 10:37 |
I intend to address this one by checking for, and handling, inf and nan (although nan should really cause an exception to be thrown) in Mercury rather than relying on sprintf. Even with C99 there are too many annoying little differences in how inf and nan are handled. Dealing with Java and C# just complicates things further. |
juliensf (administrator) 2015-07-08 13:15 |
Fixed in commit 4e15777. |
Issue History | |||
Date Modified | Username | Field | Change |
---|---|---|---|
2014-07-18 15:07 | juliensf | New Issue | |
2014-07-18 15:46 | juliensf | Note Added: 0000747 | |
2014-07-18 16:23 | wangp | Note Added: 0000748 | |
2014-07-18 17:01 | juliensf | Note Added: 0000750 | |
2014-08-06 10:37 | juliensf | Note Added: 0000755 | |
2014-08-06 10:37 | juliensf | Assigned To | => juliensf |
2014-08-06 10:37 | juliensf | Status | new => assigned |
2015-07-08 13:15 | juliensf | Note Added: 0000838 | |
2015-07-08 13:15 | juliensf | Status | assigned => resolved |
2015-07-08 13:15 | juliensf | Resolution | open => fixed |