Commit 2d2562e9 authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Fix up error messages to remove extra newline. Use "zero" rather than "0.0".

parent ff4722cf
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.20 1997/09/08 21:48:25 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.21 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, "\tBad 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, "\tBad 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, "\tBad 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, "\tBad 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, "\tBad 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, "\tBad 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() returned a floating point out of the range\n"); elog(WARN, "pow() result 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() returned a floating point out of range\n"); elog(WARN, "exp() result 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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment