"sum" is a double so count is converted to 0.0, 0.0/0.0 == NaN, hence the
comment.

PG code usually avoids that, and I recall static analyze tools type
coverity complaining that this may lead to undefined behavior. While I
agree that this would lead to NaN...

Hmmm. In this case that is what is actually wanted. If there is no transaction, the tps or average latency or whatever is "NaN", I cannot help it, and IEEE 754 allow that. So in this case the tool is wrong if it complains, or at least we are right to ignore the warning. Maybe there is some special comment to say "ignore this warning on the next line" if it occurs, if this is an issue.

--
Fabien.


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to