88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.135 2007/01/02 22:19:42 momjian Exp $
11+ * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.136 2007/01/03 04:21:47 momjian Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -1439,15 +1439,11 @@ dpow(PG_FUNCTION_ARGS)
14391439errmsg ("invalid argument for power function" )));
14401440
14411441/*
1442- * We must check both for errno getting set and for a NaN result, in order
1443- * to deal with the vagaries of different platforms...
1442+ * pow() sets errno only on some platforms, depending on whether it
1443+ * follows _IEEE_, _POSIX_, _XOPEN_, or _SVID_, so, for consistency,
1444+ * we don't consult it and just do our check below.
14441445 */
1445- errno = 0 ;
14461446result = pow (arg1 ,arg2 );
1447- if (errno != 0 && !isinf (result ))
1448- ereport (ERROR ,
1449- (errcode (ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE ),
1450- errmsg ("result is out of range" )));
14511447
14521448CHECKFLOATVAL (result ,isinf (arg1 )|| isinf (arg2 ),arg1 == 0 );
14531449PG_RETURN_FLOAT8 (result );
@@ -1464,15 +1460,11 @@ dexp(PG_FUNCTION_ARGS)
14641460float8 result ;
14651461
14661462/*
1467- * We must check both for errno getting set and for a NaN result, in order
1468- * to deal with the vagaries of different platforms.
1463+ * exp() sets errno only on some platforms, depending on whether it
1464+ * follows _IEEE_, _POSIX_, _XOPEN_, or _SVID_, so, for consistency,
1465+ * we don't consult it and just do our check below.
14691466 */
1470- errno = 0 ;
14711467result = exp (arg1 );
1472- if (errno != 0 && !isinf (result ))
1473- ereport (ERROR ,
1474- (errcode (ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE ),
1475- errmsg ("result is out of range" )));
14761468
14771469CHECKFLOATVAL (result ,isinf (arg1 ), false);
14781470PG_RETURN_FLOAT8 (result );
@@ -1547,6 +1539,10 @@ dacos(PG_FUNCTION_ARGS)
15471539float8 arg1 = PG_GETARG_FLOAT8 (0 );
15481540float8 result ;
15491541
1542+ /*
1543+ *We use errno here because the trigonometric functions are cyclic
1544+ *and hard to check for underflow.
1545+ */
15501546errno = 0 ;
15511547result = acos (arg1 );
15521548if (errno != 0 )