Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
2d2562e9
Commit
2d2562e9
authored
27 years ago
by
Thomas G. Lockhart
Browse files
Options
Downloads
Patches
Plain Diff
Fix up error messages to remove extra newline. Use "zero" rather than "0.0".
parent
ff4722cf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/utils/adt/float.c
+26
-26
26 additions, 26 deletions
src/backend/utils/adt/float.c
with
26 additions
and
26 deletions
src/backend/utils/adt/float.c
+
26
−
26
View file @
2d2562e9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.2
0
1997/09/
08 21:48:25 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.2
1
1997/09/
13 03:10:11 thomas
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -161,9 +161,9 @@ CheckFloat4Val(double val)
...
@@ -161,9 +161,9 @@ CheckFloat4Val(double val)
return
;
return
;
#else
#else
if
(
fabs
(
val
)
>
FLOAT4_MAX
)
if
(
fabs
(
val
)
>
FLOAT4_MAX
)
elog
(
WARN
,
"
\t
Bad float4 input format -- overflow
\n
"
);
elog
(
WARN
,
"Bad float4 input format -- overflow"
);
if
(
val
!=
0
.
0
&&
fabs
(
val
)
<
FLOAT4_MIN
)
if
(
val
!=
0
.
0
&&
fabs
(
val
)
<
FLOAT4_MIN
)
elog
(
WARN
,
"
\t
Bad float4 input format -- underflow
\n
"
);
elog
(
WARN
,
"Bad float4 input format -- underflow"
);
return
;
return
;
#endif
/* UNSAFE_FLOATS */
#endif
/* UNSAFE_FLOATS */
}
}
...
@@ -186,9 +186,9 @@ CheckFloat8Val(double val)
...
@@ -186,9 +186,9 @@ CheckFloat8Val(double val)
return
;
return
;
#else
#else
if
(
fabs
(
val
)
>
FLOAT8_MAX
)
if
(
fabs
(
val
)
>
FLOAT8_MAX
)
elog
(
WARN
,
"
\t
Bad float8 input format -- overflow
\n
"
);
elog
(
WARN
,
"Bad float8 input format -- overflow"
);
if
(
val
!=
0
.
0
&&
fabs
(
val
)
<
FLOAT8_MIN
)
if
(
val
!=
0
.
0
&&
fabs
(
val
)
<
FLOAT8_MIN
)
elog
(
WARN
,
"
\t
Bad float8 input format -- underflow
\n
"
);
elog
(
WARN
,
"Bad float8 input format -- underflow"
);
return
;
return
;
#endif
/* UNSAFE_FLOATS */
#endif
/* UNSAFE_FLOATS */
}
}
...
@@ -210,7 +210,7 @@ float4in(char *num)
...
@@ -210,7 +210,7 @@ float4in(char *num)
errno
=
0
;
errno
=
0
;
val
=
strtod
(
num
,
&
endptr
);
val
=
strtod
(
num
,
&
endptr
);
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
elog
(
WARN
,
"
\t
Bad float4 input format
\n
"
);
elog
(
WARN
,
"Bad float4 input format
'%s'"
,
num
);
/*
/*
* if we get here, we have a legal double, still need to check to see
* if we get here, we have a legal double, still need to check to see
...
@@ -257,7 +257,7 @@ float8in(char *num)
...
@@ -257,7 +257,7 @@ float8in(char *num)
errno
=
0
;
errno
=
0
;
val
=
strtod
(
num
,
&
endptr
);
val
=
strtod
(
num
,
&
endptr
);
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
elog
(
WARN
,
"
\t
Bad float8 input format
\n
"
);
elog
(
WARN
,
"Bad float8 input format
'%s'"
,
num
);
CheckFloat8Val
(
val
);
CheckFloat8Val
(
val
);
*
result
=
val
;
*
result
=
val
;
...
@@ -515,7 +515,7 @@ float4div(float32 arg1, float32 arg2)
...
@@ -515,7 +515,7 @@ float4div(float32 arg1, float32 arg2)
return
(
float32
)
NULL
;
return
(
float32
)
NULL
;
if
(
*
arg2
==
0
.
0
)
if
(
*
arg2
==
0
.
0
)
elog
(
WARN
,
"float4div:
divide by
0.0
error"
);
elog
(
WARN
,
"float4div: divide by
zero
error"
);
val
=
*
arg1
/
*
arg2
;
val
=
*
arg1
/
*
arg2
;
...
@@ -609,7 +609,7 @@ float8div(float64 arg1, float64 arg2)
...
@@ -609,7 +609,7 @@ float8div(float64 arg1, float64 arg2)
result
=
(
float64
)
palloc
(
sizeof
(
float64data
));
result
=
(
float64
)
palloc
(
sizeof
(
float64data
));
if
(
*
arg2
==
0
.
0
)
if
(
*
arg2
==
0
.
0
)
elog
(
WARN
,
"float8div:
divide by
0.0
error"
);
elog
(
WARN
,
"float8div: divide by
zero
error"
);
val
=
*
arg1
/
*
arg2
;
val
=
*
arg1
/
*
arg2
;
CheckFloat8Val
(
val
);
CheckFloat8Val
(
val
);
...
@@ -805,11 +805,11 @@ dtoi4(float64 num)
...
@@ -805,11 +805,11 @@ dtoi4(float64 num)
{
{
int32
result
;
int32
result
;
if
(
!
num
)
if
(
!
PointerIsValid
(
num
)
)
elog
(
WARN
,
"dtoi4:
unable to convert null"
,
NULL
);
elog
(
WARN
,
"dtoi4: unable to convert null"
,
NULL
);
if
((
*
num
<
INT_MIN
)
||
(
*
num
>
INT_MAX
))
if
((
*
num
<
INT_MIN
)
||
(
*
num
>
INT_MAX
))
elog
(
WARN
,
"dtoi4:
integer out of range"
,
NULL
);
elog
(
WARN
,
"dtoi4: integer out of range"
,
NULL
);
result
=
rint
(
*
num
);
result
=
rint
(
*
num
);
return
(
result
);
return
(
result
);
...
@@ -824,11 +824,11 @@ dtoi2(float64 num)
...
@@ -824,11 +824,11 @@ dtoi2(float64 num)
{
{
int16
result
;
int16
result
;
if
(
!
num
)
if
(
!
PointerIsValid
(
num
)
)
elog
(
WARN
,
"dtoi2:
unable to convert null"
,
NULL
);
elog
(
WARN
,
"dtoi2: unable to convert null"
,
NULL
);
if
((
*
num
<
SHRT_MIN
)
||
(
*
num
>
SHRT_MAX
))
if
((
*
num
<
SHRT_MIN
)
||
(
*
num
>
SHRT_MAX
))
elog
(
WARN
,
"dtoi2:
integer out of range"
,
NULL
);
elog
(
WARN
,
"dtoi2: integer out of range"
,
NULL
);
result
=
rint
(
*
num
);
result
=
rint
(
*
num
);
return
(
result
);
return
(
result
);
...
@@ -873,11 +873,11 @@ ftoi4(float32 num)
...
@@ -873,11 +873,11 @@ ftoi4(float32 num)
{
{
int32
result
;
int32
result
;
if
(
!
num
)
if
(
!
PointerIsValid
(
num
)
)
elog
(
WARN
,
"ftoi4:
unable to convert null"
,
NULL
);
elog
(
WARN
,
"ftoi4: unable to convert null"
,
NULL
);
if
((
*
num
<
INT_MIN
)
||
(
*
num
>
INT_MAX
))
if
((
*
num
<
INT_MIN
)
||
(
*
num
>
INT_MAX
))
elog
(
WARN
,
"ftoi4:
integer out of range"
,
NULL
);
elog
(
WARN
,
"ftoi4: integer out of range"
,
NULL
);
result
=
rint
(
*
num
);
result
=
rint
(
*
num
);
return
(
result
);
return
(
result
);
...
@@ -892,11 +892,11 @@ ftoi2(float32 num)
...
@@ -892,11 +892,11 @@ ftoi2(float32 num)
{
{
int16
result
;
int16
result
;
if
(
!
num
)
if
(
!
PointerIsValid
(
num
)
)
elog
(
WARN
,
"ftoi2:
unable to convert null"
,
NULL
);
elog
(
WARN
,
"ftoi2: unable to convert null"
,
NULL
);
if
((
*
num
<
SHRT_MIN
)
||
(
*
num
>
SHRT_MAX
))
if
((
*
num
<
SHRT_MIN
)
||
(
*
num
>
SHRT_MAX
))
elog
(
WARN
,
"ftoi2:
integer out of range"
,
NULL
);
elog
(
WARN
,
"ftoi2: integer out of range"
,
NULL
);
result
=
rint
(
*
num
);
result
=
rint
(
*
num
);
return
(
result
);
return
(
result
);
...
@@ -1052,7 +1052,7 @@ dpow(float64 arg1, float64 arg2)
...
@@ -1052,7 +1052,7 @@ dpow(float64 arg1, float64 arg2)
#else
#else
if
(
!
finite
(
*
result
))
if
(
!
finite
(
*
result
))
#endif
#endif
elog
(
WARN
,
"pow() re
turned a floating point
out of
the
range
\n
"
);
elog
(
WARN
,
"pow() re
sult is
out of range"
);
CheckFloat8Val
(
*
result
);
CheckFloat8Val
(
*
result
);
return
(
result
);
return
(
result
);
...
@@ -1083,7 +1083,7 @@ dexp(float64 arg1)
...
@@ -1083,7 +1083,7 @@ dexp(float64 arg1)
#else
#else
if
(
!
finite
(
*
result
))
if
(
!
finite
(
*
result
))
#endif
#endif
elog
(
WARN
,
"exp() re
turned a floating point
out of range
\n
"
);
elog
(
WARN
,
"exp() re
sult is
out of range"
);
CheckFloat8Val
(
*
result
);
CheckFloat8Val
(
*
result
);
return
(
result
);
return
(
result
);
...
@@ -1107,7 +1107,7 @@ dlog1(float64 arg1)
...
@@ -1107,7 +1107,7 @@ dlog1(float64 arg1)
tmp
=
*
arg1
;
tmp
=
*
arg1
;
if
(
tmp
==
0
.
0
)
if
(
tmp
==
0
.
0
)
elog
(
WARN
,
"can't take log of
0!
"
);
elog
(
WARN
,
"can't take log of
zero
"
);
if
(
tmp
<
0
)
if
(
tmp
<
0
)
elog
(
WARN
,
"can't take log of a negative number"
);
elog
(
WARN
,
"can't take log of a negative number"
);
*
result
=
(
float64data
)
log
(
tmp
);
*
result
=
(
float64data
)
log
(
tmp
);
...
@@ -1185,7 +1185,7 @@ float48div(float32 arg1, float64 arg2)
...
@@ -1185,7 +1185,7 @@ float48div(float32 arg1, float64 arg2)
result
=
(
float64
)
palloc
(
sizeof
(
float64data
));
result
=
(
float64
)
palloc
(
sizeof
(
float64data
));
if
(
*
arg2
==
0
.
0
)
if
(
*
arg2
==
0
.
0
)
elog
(
WARN
,
"float48div:
divide by
0.0 error!
"
);
elog
(
WARN
,
"float48div: divide by
zero
"
);
*
result
=
*
arg1
/
*
arg2
;
*
result
=
*
arg1
/
*
arg2
;
CheckFloat8Val
(
*
result
);
CheckFloat8Val
(
*
result
);
...
@@ -1255,7 +1255,7 @@ float84div(float64 arg1, float32 arg2)
...
@@ -1255,7 +1255,7 @@ float84div(float64 arg1, float32 arg2)
result
=
(
float64
)
palloc
(
sizeof
(
float64data
));
result
=
(
float64
)
palloc
(
sizeof
(
float64data
));
if
(
*
arg2
==
0
.
0
)
if
(
*
arg2
==
0
.
0
)
elog
(
WARN
,
"float48div:
divide by
0.0 error!
"
);
elog
(
WARN
,
"float48div: divide by
zero
"
);
*
result
=
*
arg1
/
*
arg2
;
*
result
=
*
arg1
/
*
arg2
;
CheckFloat8Val
(
*
result
);
CheckFloat8Val
(
*
result
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment