Content-Length: 260055 | pFad | http://github.com/postgrespro/postgres_cluster/commit/686d399f2be6eea4b74d59cdadd427d09cb0e246

B2 Fix non-portable use of round(). · postgrespro/postgres_cluster@686d399 · GitHub
Skip to content

Commit 686d399

Browse files
committed
Fix non-portable use of round().
round() is from C99. Use rint() instead. There are behavioral differences between round() and rint(), but they should not matter to the Bloom filter optimal_k() function. We already assume POSIX behavior for rint(), so there is no question of rint() not using "rounds towards nearest" as its rounding mode. Cleanup from commit 51bc271. Per buildfarm member thrips. Author: Peter Geoghegan Discussion: https://postgr.es/m/CAH2-Wzn76eCGUonARy-wrVtMHsf+4cvbK_oJAWTLfORTU5ki0w@mail.gmail.com
1 parent 7f563c0 commit 686d399

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/lib/bloomfilter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ my_bloom_power(uint64 target_bitset_bits)
240240
static int
241241
optimal_k(uint64 bitset_bits, int64 total_elems)
242242
{
243-
int k = round(log(2.0) * bitset_bits / total_elems);
243+
int k = rint(log(2.0) * bitset_bits / total_elems);
244244

245245
return Max(1, Min(k, MAX_HASH_FUNCS));
246246
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/686d399f2be6eea4b74d59cdadd427d09cb0e246

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy