On Wed, Dec 16, 2015 at 4:09 PM, Michael Paquier <michael.paqu...@gmail.com> wrote: > Yeah, that's actually fine. I just had a look at Windows stuff, and > things seem to be correct on this side for double: > https://msdn.microsoft.com/en-us/library/aa691373%28v=vs.71%29.aspx > And then I also had a look at src/port/snprintf.c, where things get > actually weird when no transactions are run for a script (emulated > with 2 scripts, one with @10000 and the second with @1): > - 0 transactions (0.0% of total, tps = 0.000000) > - latency average = -1.#IO ms > - latency stddev = -1.#IO ms > And it seems that this is a bug in fmtfloat() because it does not > handle nan values correctly. Others, any thoughts about that? > It is possible to address things within your patch by using isnan() > and print another message but I think that we had better patch > snprintf.c if my analysis is right.
FWIW, I just had a closer look at this portion and I arrived at the conclusion that sprintf implementation on Windows is just broken as it is not able to handle appropriately inf or nan as exceptions. fmtfloat@src/port/snprintf.c relies on the system's implementation of sprintf to handle those exceptions, however even directly calling sprintf results in the same weird output, inf showing up as "1.#IO" and nan as "-1.#IO". Anyone, feel free to disagree if I am missing something. Still, it would be cool to have better error message when there is no value to show up to the user, like "no latency average" or "undefined latency average". That would be more elegant, and the patches proposed still lack that. -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers