nitpick about useless floating point division in gimme_edge_table

From: Mark Dilger <hornschnorter(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: nitpick about useless floating point division in gimme_edge_table
Date: 2019-05-23 03:57:49
Message-ID: CAE-h2TpCxqiYmA4zmEfaHW9VGC+wWEuXoL_R9z9kMfkhiNHntg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

The return value of gimme_edge_table is not used anywhere in the
core code, so far as I can see. But the value is computed as

/* return average number of edges per index */
return ((float) (edge_total * 2) / (float) num_gene);

which involves some floating point math. I'm not sure that this matters
much, but (1) it deceives a reader of this code into thinking that this
calculation is meaningful, which it is not, and (2) gimme_edge_table is
called inside a loop, so this is happening repeatedly, though admittedly
that loop is perhaps not terribly large.

mark

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-05-23 04:00:35 Re: Remove useless associativity/precedence from parsers
Previous Message Andrew Gierth 2019-05-23 03:49:57 Re: Patch to fix write after end of array in hashed agg initialization