1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Don't use is_infinite() where isinf() will do.

Places that aren't testing for sign should not use the more expensive
function; it's just wasteful, not to mention being a cognitive load
for readers who may know what isinf() is but not is_infinite().

As things stand, we actually don't need is_infinite() anyplace except
float4out/float8out, which means it could potentially go away altogether
after the changes I proposed in <13178.1538794717@sss.pgh.pa.us>.
This commit is contained in:
Tom Lane
2018-10-06 13:18:38 -04:00
parent 07ee62ce9e
commit 0209f0285d
2 changed files with 10 additions and 8 deletions

View File

@ -5731,7 +5731,7 @@ float4_to_char(PG_FUNCTION_ARGS)
numstr = orgnum = int_to_roman((int) rint(value));
else if (IS_EEEE(&Num))
{
if (isnan(value) || is_infinite(value))
if (isnan(value) || isinf(value))
{
/*
* Allow 6 characters for the leading sign, the decimal point,
@ -5835,7 +5835,7 @@ float8_to_char(PG_FUNCTION_ARGS)
numstr = orgnum = int_to_roman((int) rint(value));
else if (IS_EEEE(&Num))
{
if (isnan(value) || is_infinite(value))
if (isnan(value) || isinf(value))
{
/*
* Allow 6 characters for the leading sign, the decimal point,