77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.20 1997/09/08 21:48:25 momjian Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.21 1997/09/13 03:10:11 thomas Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -161,9 +161,9 @@ CheckFloat4Val(double val)
161161return ;
162162#else
163163if (fabs (val )> FLOAT4_MAX )
164- elog (WARN ,"\tBad float4 input format -- overflow\n " );
164+ elog (WARN ,"Bad float4 input format -- overflow" );
165165if (val != 0.0 && fabs (val )< FLOAT4_MIN )
166- elog (WARN ,"\tBad float4 input format -- underflow\n " );
166+ elog (WARN ,"Bad float4 input format -- underflow" );
167167return ;
168168#endif /* UNSAFE_FLOATS */
169169}
@@ -186,9 +186,9 @@ CheckFloat8Val(double val)
186186return ;
187187#else
188188if (fabs (val )> FLOAT8_MAX )
189- elog (WARN ,"\tBad float8 input format -- overflow\n " );
189+ elog (WARN ,"Bad float8 input format -- overflow" );
190190if (val != 0.0 && fabs (val )< FLOAT8_MIN )
191- elog (WARN ,"\tBad float8 input format -- underflow\n " );
191+ elog (WARN ,"Bad float8 input format -- underflow" );
192192return ;
193193#endif /* UNSAFE_FLOATS */
194194}
@@ -210,7 +210,7 @@ float4in(char *num)
210210errno = 0 ;
211211val = strtod (num ,& endptr );
212212if (* endptr != '\0' || errno == ERANGE )
213- elog (WARN ,"\tBad float4 input format\n" );
213+ elog (WARN ,"Bad float4 input format '%s'" , num );
214214
215215/*
216216 * if we get here, we have a legal double, still need to check to see
@@ -257,7 +257,7 @@ float8in(char *num)
257257errno = 0 ;
258258val = strtod (num ,& endptr );
259259if (* endptr != '\0' || errno == ERANGE )
260- elog (WARN ,"\tBad float8 input format\n" );
260+ elog (WARN ,"Bad float8 input format '%s'" , num );
261261
262262CheckFloat8Val (val );
263263* result = val ;
@@ -515,7 +515,7 @@ float4div(float32 arg1, float32 arg2)
515515return (float32 )NULL ;
516516
517517if (* arg2 == 0.0 )
518- elog (WARN ,"float4div: divide by0.0 error" );
518+ elog (WARN ,"float4div: divide byzero error" );
519519
520520val = * arg1 /* arg2 ;
521521
@@ -609,7 +609,7 @@ float8div(float64 arg1, float64 arg2)
609609result = (float64 )palloc (sizeof (float64data ));
610610
611611if (* arg2 == 0.0 )
612- elog (WARN ,"float8div: divide by0.0 error" );
612+ elog (WARN ,"float8div: divide byzero error" );
613613
614614val = * arg1 /* arg2 ;
615615CheckFloat8Val (val );
@@ -805,11 +805,11 @@ dtoi4(float64 num)
805805{
806806int32 result ;
807807
808- if (!num )
809- elog (WARN ,"dtoi4: unable to convert null" ,NULL );
808+ if (!PointerIsValid ( num ) )
809+ elog (WARN ,"dtoi4: unable to convert null" ,NULL );
810810
811811if ((* num < INT_MIN )|| (* num > INT_MAX ))
812- elog (WARN ,"dtoi4: integer out of range" ,NULL );
812+ elog (WARN ,"dtoi4: integer out of range" ,NULL );
813813
814814result = rint (* num );
815815return (result );
@@ -824,11 +824,11 @@ dtoi2(float64 num)
824824{
825825int16 result ;
826826
827- if (!num )
828- elog (WARN ,"dtoi2: unable to convert null" ,NULL );
827+ if (!PointerIsValid ( num ) )
828+ elog (WARN ,"dtoi2: unable to convert null" ,NULL );
829829
830830if ((* num < SHRT_MIN )|| (* num > SHRT_MAX ))
831- elog (WARN ,"dtoi2: integer out of range" ,NULL );
831+ elog (WARN ,"dtoi2: integer out of range" ,NULL );
832832
833833result = rint (* num );
834834return (result );
@@ -873,11 +873,11 @@ ftoi4(float32 num)
873873{
874874int32 result ;
875875
876- if (!num )
877- elog (WARN ,"ftoi4: unable to convert null" ,NULL );
876+ if (!PointerIsValid ( num ) )
877+ elog (WARN ,"ftoi4: unable to convert null" ,NULL );
878878
879879if ((* num < INT_MIN )|| (* num > INT_MAX ))
880- elog (WARN ,"ftoi4: integer out of range" ,NULL );
880+ elog (WARN ,"ftoi4: integer out of range" ,NULL );
881881
882882result = rint (* num );
883883return (result );
@@ -892,11 +892,11 @@ ftoi2(float32 num)
892892{
893893int16 result ;
894894
895- if (!num )
896- elog (WARN ,"ftoi2: unable to convert null" ,NULL );
895+ if (!PointerIsValid ( num ) )
896+ elog (WARN ,"ftoi2: unable to convert null" ,NULL );
897897
898898if ((* num < SHRT_MIN )|| (* num > SHRT_MAX ))
899- elog (WARN ,"ftoi2: integer out of range" ,NULL );
899+ elog (WARN ,"ftoi2: integer out of range" ,NULL );
900900
901901result = rint (* num );
902902return (result );
@@ -1052,7 +1052,7 @@ dpow(float64 arg1, float64 arg2)
10521052#else
10531053if (!finite (* result ))
10541054#endif
1055- elog (WARN ,"pow()returned a floating point out ofthe range\n " );
1055+ elog (WARN ,"pow()result is out of range" );
10561056
10571057CheckFloat8Val (* result );
10581058return (result );
@@ -1083,7 +1083,7 @@ dexp(float64 arg1)
10831083#else
10841084if (!finite (* result ))
10851085#endif
1086- elog (WARN ,"exp()returned a floating point out of range\n " );
1086+ elog (WARN ,"exp()result is out of range" );
10871087
10881088CheckFloat8Val (* result );
10891089return (result );
@@ -1107,7 +1107,7 @@ dlog1(float64 arg1)
11071107
11081108tmp = * arg1 ;
11091109if (tmp == 0.0 )
1110- elog (WARN ,"can't take log of0! " );
1110+ elog (WARN ,"can't take log ofzero " );
11111111if (tmp < 0 )
11121112elog (WARN ,"can't take log of a negative number" );
11131113* result = (float64data )log (tmp );
@@ -1185,7 +1185,7 @@ float48div(float32 arg1, float64 arg2)
11851185result = (float64 )palloc (sizeof (float64data ));
11861186
11871187if (* arg2 == 0.0 )
1188- elog (WARN ,"float48div: divide by0.0 error! " );
1188+ elog (WARN ,"float48div: divide byzero " );
11891189
11901190* result = * arg1 /* arg2 ;
11911191CheckFloat8Val (* result );
@@ -1255,7 +1255,7 @@ float84div(float64 arg1, float32 arg2)
12551255result = (float64 )palloc (sizeof (float64data ));
12561256
12571257if (* arg2 == 0.0 )
1258- elog (WARN ,"float48div: divide by0.0 error! " );
1258+ elog (WARN ,"float48div: divide byzero " );
12591259
12601260* result = * arg1 /* arg2 ;
12611261CheckFloat8Val (* result );