Re: [HACKERS] pow support for pgbench - Mailing list pgsql-hackers

From Raúl Marín Rodríguez
Subject Re: [HACKERS] pow support for pgbench
Date
Msg-id CAM6_UM5iSV2akq5xZDNHzf4G4n=PBg-vvmruA2ri7ws8e6CzYA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] pow support for pgbench  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: [HACKERS] pow support for pgbench  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: [HACKERS] pow support for pgbench  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi all, I've been giving a thought about this and I think we could reach the compromise of having a single function with 2 overloads: * pow(double, double) -> double: Uses C pow(). * pow(int, int) -> double: Uses ipow() for positive exponents, and pow() for negative exponents. In both cases we'd return a double but we use the fast ipow if it's possible (which can be 20x faster), so at the cost of an extra cast if you need an int, we'd have a consistent API. Would this be acceptable?

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: es_query_dsa is broken
Next
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] pow support for pgbench