Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
b2965b9f
Commit
b2965b9f
authored
Jan 06, 2007
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put back ERANGE test in dpow(). There are platforms that need this,
like my HPPA ...
parent
561b4bae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
src/backend/utils/adt/float.c
src/backend/utils/adt/float.c
+10
-7
No files found.
src/backend/utils/adt/float.c
View file @
b2965b9f
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.14
2 2007/01/05 22:19:40 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.14
3 2007/01/06 02:28:38 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1442,24 +1442,27 @@ dpow(PG_FUNCTION_ARGS)
* pow() sets errno only on some platforms, depending on whether it
* follows _IEEE_, _POSIX_, _XOPEN_, or _SVID_, so we try to avoid
* using errno. However, some platform/CPU combinations return
* errno == EDOM and result == Nan, so we have to check for that and
* set result properly. For example, Linux on 32-bit x86 hardware
* returns EDOM/Nan for (-1) ^ 1e19, but (-1) ^ 1e18 returns
* 1 -- basically a negative base raised to a very high power causes
* it on some CPUs.
* errno == EDOM and result == Nan for negative arg1 and very large arg2
* (they must be using something different from our floor() test to
* decide it's invalid). Other platforms return errno == ERANGE and a
* large but finite result to signal overflow.
*/
errno
=
0
;
result
=
pow
(
arg1
,
arg2
);
if
(
errno
==
EDOM
&&
isnan
(
result
))
{
if
((
fabs
(
arg1
)
>
1
&&
arg2
>=
0
)
||
(
fabs
(
arg1
)
<
1
&&
arg2
<
0
))
/* The sign
i
f Inf is not significant in this case. */
/* The sign
o
f Inf is not significant in this case. */
result
=
get_float8_infinity
();
else
if
(
fabs
(
arg1
)
!=
1
)
result
=
0
;
else
result
=
1
;
}
else
if
(
errno
==
ERANGE
)
{
result
=
(
arg1
>=
0
)
?
get_float8_infinity
()
:
-
get_float8_infinity
();
}
CHECKFLOATVAL
(
result
,
isinf
(
arg1
)
||
isinf
(
arg2
),
arg1
==
0
);
PG_RETURN_FLOAT8
(
result
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment