agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: John Naylor <john.naylor@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix loss of precision in pg_stat_us_to_ms()
Date: Thu, 02 Jul 2026 06:36:39 +0000
Message-ID: <E1wfB2N-00138j-2f@gemulon.postgresql.org> (raw)

Fix loss of precision in pg_stat_us_to_ms()

Multiplying by the constant 0.001 can produce trailing-digit noise in
displayed values (for example 0.009000000000000001 instead of 0.009,
with default extra_float_digits) because 0.001 cannot be represented
exactly in binary floating point. Use division by 1000.0 instead,
matching code elsewhere in the tree.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/akIYkMK4bHe9qX/N@bdtpg

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3eca140531f1c8e58e9a59af827488616699a052

Modified Files
--------------
src/backend/utils/adt/pgstatfuncs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



Message-ID: <E1wfB2N-00138j-2f@gemulon.postgresql.org>
Permalink:  ../E1wfB2N-00138j-2f@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wfB2N-00138j-2f@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: john.naylor@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix loss of precision in pg_stat_us_to_ms()
  In-Reply-To: <E1wfB2N-00138j-2f@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox