Re: integer square root function proposed

2022-12-17 Thread Tom Lane
"Martin L. Buchanan" writes: > Reading the documentation I found no built-in function for integer square > root, requiring a sequence of: > floor(sqrt(foo))::integer > to go from an integer to the integer square root as an integer. I'm a little down on this idea, mainly because I doubt there is a

Re: integer square root function proposed

2022-12-17 Thread Rob Sargent
On 12/17/22 20:40, Martin L. Buchanan wrote: Dear Rob and all readers: Generating prime numbers is one example where you use integer square root in the inner loop, going from integer to integer. Calculating an integer square root from an integer input may have a more efficient algorithm than

Re: integer square root function proposed

2022-12-17 Thread Martin L. Buchanan
Dear Rob and all readers: Generating prime numbers is one example where you use integer square root in the inner loop, going from integer to integer. Calculating an integer square root from an integer input may have a more efficient algorithm than doing so in floating-point, with the caveat that

Re: integer square root function proposed

2022-12-17 Thread Rob Sargent
On 12/17/22 19:39, Martin L. Buchanan wrote: Dear PostgreSQL colleagues: I have just joined this, my first PG mailing list. Reading the documentation I found no built-in function for integer square root, requiring a sequence of: floor(sqrt(foo))::integer to go from an integer to the integer

integer square root function proposed

2022-12-17 Thread Martin L. Buchanan
Dear PostgreSQL colleagues: I have just joined this, my first PG mailing list. Reading the documentation I found no built-in function for integer square root, requiring a sequence of: floor(sqrt(foo))::integer to go from an integer to the integer square root as an integer. If PG leaders smile