ignore the zero flag for nan/inf/err#303
Conversation
|
Looks like this is failing for the @stefano-zanotti-88 are you seeing this on your version? |
|
I'm not familiar with the error reporting used by these tests. Can you determine which of these lines is the one failing? nanoprintf/tests/conformance.cc Lines 552 to 559 in 0e8caaf My first guess is that the system printf is not respecting the sign, while we are. See the standard (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf), on page 333: It's never explicit about what sign a NaN should have. The obvious thing is to respect the sign bit from the binary representation. However, the default In the end, I don't think we should be checking against the system printf at all when it comes to nans, but only against one specific string among the ones that the standard allows. For instance, the system printf could also output "nan(0x8000000000000)", or "-nan(0x8000000000000)". Some non-conforming implementations also output "1.#QNAN" or "1.#SNAN" Watch out for INFINITY too. The standard allows both "inf" and "infinity". However, in that case, the sign is certainly respected, and an infinity cannot be substituted by the other one by trivial operations. |
|
Ugh, yeah, that seems to be what's happening. Since all of this stuff is so ill-defined, I think it's wrong to use the conformance stuff- the point of that code is to make sure that nanoprintf behaves identically to the system printf, to learn about divergences. But, I've seen 3 different NAN printing behaviors on a few different systems i've tested, so I'm going to change the tests to just ensure that nanoprintf prints what we feel it should. |
|
I pulled all the new NaN / INF stuff out into a new file and fixed up the tests for it. They're all passing, it's much better. |
This PR is a reimplementation of #289 by @stefano-zanotti-88 at my computer so that I can iterate on tests.