Commit 463f1f5c authored by Tom Lane's avatar Tom Lane

Convert all remaining float4 and float8 functions to new fmgr style.

At this point I think it'd be possible to make float4 be pass-by-value
without too much work --- and float8 too on machines where Datum is
8 bytes.  Something to try when the mood strikes, anyway.
parent 92bd532c
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.39 2000/07/14 15:35:44 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.40 2000/08/01 18:29:29 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -566,7 +566,7 @@ parse_random_seed(char *value) ...@@ -566,7 +566,7 @@ parse_random_seed(char *value)
else else
{ {
sscanf(value, "%lf", &seed); sscanf(value, "%lf", &seed);
setseed(&seed); DirectFunctionCall1(setseed, Float8GetDatum(seed));
} }
return (TRUE); return (TRUE);
} }
...@@ -583,7 +583,7 @@ reset_random_seed(void) ...@@ -583,7 +583,7 @@ reset_random_seed(void)
{ {
double seed = 0.5; double seed = 0.5;
setseed(&seed); DirectFunctionCall1(setseed, Float8GetDatum(seed));
return (TRUE); return (TRUE);
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* workings can be found in the book "Software Solutions in C" by * workings can be found in the book "Software Solutions in C" by
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7. * Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.43 2000/07/07 18:49:52 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.44 2000/08/01 18:29:35 tgl Exp $
*/ */
#include <limits.h> #include <limits.h>
...@@ -425,31 +425,31 @@ cash_mi(Cash *c1, Cash *c2) ...@@ -425,31 +425,31 @@ cash_mi(Cash *c1, Cash *c2)
/* cash_mul_flt8() /* cash_mul_flt8()
* Multiply cash by float8. * Multiply cash by float8.
*/ */
Cash * Datum
cash_mul_flt8(Cash *c, float8 *f) cash_mul_flt8(PG_FUNCTION_ARGS)
{ {
Cash *result; Cash c = PG_GETARG_CASH(0);
float8 f = PG_GETARG_FLOAT8(1);
if (!PointerIsValid(f) || !PointerIsValid(c)) Cash result;
return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't multiply cash");
*result = ((*f) * (*c));
return result; result = c * f;
} /* cash_mul_flt8() */ PG_RETURN_CASH(result);
}
/* flt8_mul_cash() /* flt8_mul_cash()
* Multiply float8 by cash. * Multiply float8 by cash.
*/ */
Cash * Datum
flt8_mul_cash(float8 *f, Cash *c) flt8_mul_cash(PG_FUNCTION_ARGS)
{ {
return cash_mul_flt8(c, f); float8 f = PG_GETARG_FLOAT8(0);
} /* flt8_mul_cash() */ Cash c = PG_GETARG_CASH(1);
Cash result;
result = f * c;
PG_RETURN_CASH(result);
}
/* cash_div_flt8() /* cash_div_flt8()
...@@ -458,53 +458,48 @@ flt8_mul_cash(float8 *f, Cash *c) ...@@ -458,53 +458,48 @@ flt8_mul_cash(float8 *f, Cash *c)
* XXX Don't know if rounding or truncating is correct behavior. * XXX Don't know if rounding or truncating is correct behavior.
* Round for now. - tgl 97/04/15 * Round for now. - tgl 97/04/15
*/ */
Cash * Datum
cash_div_flt8(Cash *c, float8 *f) cash_div_flt8(PG_FUNCTION_ARGS)
{ {
Cash *result; Cash c = PG_GETARG_CASH(0);
float8 f = PG_GETARG_FLOAT8(1);
if (!PointerIsValid(f) || !PointerIsValid(c)) Cash result;
return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't divide cash");
if (*f == 0.0) if (f == 0.0)
elog(ERROR, "cash_div: divide by 0.0 error"); elog(ERROR, "cash_div: divide by 0.0 error");
*result = rint(*c / *f); result = rint(c / f);
PG_RETURN_CASH(result);
return result; }
} /* cash_div_flt8() */
/* cash_mul_flt4() /* cash_mul_flt4()
* Multiply cash by float4. * Multiply cash by float4.
*/ */
Cash * Datum
cash_mul_flt4(Cash *c, float4 *f) cash_mul_flt4(PG_FUNCTION_ARGS)
{ {
Cash *result; Cash c = PG_GETARG_CASH(0);
float4 f = PG_GETARG_FLOAT4(1);
if (!PointerIsValid(f) || !PointerIsValid(c)) Cash result;
return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't multiply cash");
*result = ((*f) * (*c));
return result; result = c * f;
} /* cash_mul_flt4() */ PG_RETURN_CASH(result);
}
/* flt4_mul_cash() /* flt4_mul_cash()
* Multiply float4 by float4. * Multiply float4 by cash.
*/ */
Cash * Datum
flt4_mul_cash(float4 *f, Cash *c) flt4_mul_cash(PG_FUNCTION_ARGS)
{ {
return cash_mul_flt4(c, f); float4 f = PG_GETARG_FLOAT4(0);
} /* flt4_mul_cash() */ Cash c = PG_GETARG_CASH(1);
Cash result;
result = f * c;
PG_RETURN_CASH(result);
}
/* cash_div_flt4() /* cash_div_flt4()
...@@ -513,24 +508,19 @@ flt4_mul_cash(float4 *f, Cash *c) ...@@ -513,24 +508,19 @@ flt4_mul_cash(float4 *f, Cash *c)
* XXX Don't know if rounding or truncating is correct behavior. * XXX Don't know if rounding or truncating is correct behavior.
* Round for now. - tgl 97/04/15 * Round for now. - tgl 97/04/15
*/ */
Cash * Datum
cash_div_flt4(Cash *c, float4 *f) cash_div_flt4(PG_FUNCTION_ARGS)
{ {
Cash *result; Cash c = PG_GETARG_CASH(0);
float4 f = PG_GETARG_FLOAT4(1);
if (!PointerIsValid(f) || !PointerIsValid(c)) Cash result;
return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't divide cash");
if (*f == 0.0) if (f == 0.0)
elog(ERROR, "cash_div: divide by 0.0 error"); elog(ERROR, "cash_div: divide by 0.0 error");
*result = rint(*c / *f); result = rint(c / f);
PG_RETURN_CASH(result);
return result; }
} /* cash_div_flt4() */
/* cash_mul_int4() /* cash_mul_int4()
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.66 2000/07/28 02:13:31 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.67 2000/08/01 18:29:35 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
#include "postgres.h" #include "postgres.h"
#include <limits.h> #include <limits.h>
/* for finite() on Solaris */ /* for finite() on Solaris */
#ifdef HAVE_IEEEFP_H #ifdef HAVE_IEEEFP_H
# include <ieeefp.h> # include <ieeefp.h>
...@@ -64,24 +63,6 @@ ...@@ -64,24 +63,6 @@
#include "utils/array.h" #include "utils/array.h"
#include "utils/builtins.h" #include "utils/builtins.h"
static void CheckFloat8Val(double val);
#ifndef NAN
#define NAN (0.0/0.0)
#endif
#ifndef SHRT_MAX
#define SHRT_MAX 32767
#endif
#ifndef SHRT_MIN
#define SHRT_MIN (-32768)
#endif
#define FORMAT 'g' /* use "g" output format as standard
* format */
/* not sure what the following should be, but better to make it over-sufficient */
#define MAXFLOATWIDTH 64
#define MAXDOUBLEWIDTH 128
#if !(NeXT && NX_CURRENT_COMPILER_RELEASE > NX_COMPILER_RELEASE_3_2) #if !(NeXT && NX_CURRENT_COMPILER_RELEASE > NX_COMPILER_RELEASE_3_2)
/* NS3.3 has conflicting declarations of these in <math.h> */ /* NS3.3 has conflicting declarations of these in <math.h> */
...@@ -110,6 +91,32 @@ extern double rint(double x); ...@@ -110,6 +91,32 @@ extern double rint(double x);
#endif /* NeXT check */ #endif /* NeXT check */
static void CheckFloat4Val(double val);
static void CheckFloat8Val(double val);
#ifndef M_PI
/* from my RH5.2 gcc math.h file - thomas 2000-04-03 */
#define M_PI 3.14159265358979323846
#endif
#ifndef NAN
#define NAN (0.0/0.0)
#endif
#ifndef SHRT_MAX
#define SHRT_MAX 32767
#endif
#ifndef SHRT_MIN
#define SHRT_MIN (-32768)
#endif
#define FORMAT 'g' /* use "g" output format as standard
* format */
/* not sure what the following should be, but better to make it over-sufficient */
#define MAXFLOATWIDTH 64
#define MAXDOUBLEWIDTH 128
/* ========== USER I/O ROUTINES ========== */ /* ========== USER I/O ROUTINES ========== */
...@@ -176,10 +183,10 @@ CheckFloat8Val(double val) ...@@ -176,10 +183,10 @@ CheckFloat8Val(double val)
* where <sp> is a space, digit is 0-9, * where <sp> is a space, digit is 0-9,
* <exp> is "e" or "E" followed by an integer. * <exp> is "e" or "E" followed by an integer.
*/ */
float32 Datum
float4in(char *num) float4in(PG_FUNCTION_ARGS)
{ {
float32 result = (float32) palloc(sizeof(float32data)); char *num = PG_GETARG_CSTRING(0);
double val; double val;
char *endptr; char *endptr;
...@@ -200,30 +207,25 @@ float4in(char *num) ...@@ -200,30 +207,25 @@ float4in(char *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
* if it's a legal float * if it's a legal float
*/ */
CheckFloat4Val(val); CheckFloat4Val(val);
*result = val; PG_RETURN_FLOAT4((float4) val);
return result;
} }
/* /*
* float4out - converts a float4 number to a string * float4out - converts a float4 number to a string
* using a standard output format * using a standard output format
*/ */
char * Datum
float4out(float32 num) float4out(PG_FUNCTION_ARGS)
{ {
float4 num = PG_GETARG_FLOAT4(0);
char *ascii = (char *) palloc(MAXFLOATWIDTH + 1); char *ascii = (char *) palloc(MAXFLOATWIDTH + 1);
if (!num) sprintf(ascii, "%.*g", FLT_DIG, num);
return strcpy(ascii, "(null)"); PG_RETURN_CSTRING(ascii);
sprintf(ascii, "%.*g", FLT_DIG, *num);
return ascii;
} }
/* /*
* float8in - converts "num" to float8 * float8in - converts "num" to float8
* restricted syntax: * restricted syntax:
...@@ -231,10 +233,10 @@ float4out(float32 num) ...@@ -231,10 +233,10 @@ float4out(float32 num)
* where <sp> is a space, digit is 0-9, * where <sp> is a space, digit is 0-9,
* <exp> is "e" or "E" followed by an integer. * <exp> is "e" or "E" followed by an integer.
*/ */
float64 Datum
float8in(char *num) float8in(PG_FUNCTION_ARGS)
{ {
float64 result = (float64) palloc(sizeof(float64data)); char *num = PG_GETARG_CSTRING(0);
double val; double val;
char *endptr; char *endptr;
...@@ -257,8 +259,7 @@ float8in(char *num) ...@@ -257,8 +259,7 @@ float8in(char *num)
CheckFloat8Val(val); CheckFloat8Val(val);
*result = val; PG_RETURN_FLOAT8(val);
return result;
} }
...@@ -266,21 +267,19 @@ float8in(char *num) ...@@ -266,21 +267,19 @@ float8in(char *num)
* float8out - converts float8 number to a string * float8out - converts float8 number to a string
* using a standard output format * using a standard output format
*/ */
char * Datum
float8out(float64 num) float8out(PG_FUNCTION_ARGS)
{ {
float8 num = PG_GETARG_FLOAT8(0);
char *ascii = (char *) palloc(MAXDOUBLEWIDTH + 1); char *ascii = (char *) palloc(MAXDOUBLEWIDTH + 1);
if (!num) if (isnan(num))
return strcpy(ascii, "(null)"); PG_RETURN_CSTRING(strcpy(ascii, "NaN"));
if (isinf(num))
PG_RETURN_CSTRING(strcpy(ascii, "Infinity"));
if (isnan(*num)) sprintf(ascii, "%.*g", DBL_DIG, num);
return strcpy(ascii, "NaN"); PG_RETURN_CSTRING(ascii);
if (isinf(*num))
return strcpy(ascii, "Infinity");
sprintf(ascii, "%.*g", DBL_DIG, *num);
return ascii;
} }
/* ========== PUBLIC ROUTINES ========== */ /* ========== PUBLIC ROUTINES ========== */
...@@ -293,72 +292,47 @@ float8out(float64 num) ...@@ -293,72 +292,47 @@ float8out(float64 num)
*/ */
/* /*
* float4abs - returns a pointer to |arg1| (absolute value) * float4abs - returns |arg1| (absolute value)
*/ */
float32 Datum
float4abs(float32 arg1) float4abs(PG_FUNCTION_ARGS)
{ {
float32 result; float4 arg1 = PG_GETARG_FLOAT4(0);
double val;
if (!arg1)
return (float32) NULL;
val = fabs(*arg1);
CheckFloat4Val(val); PG_RETURN_FLOAT4((float4) fabs(arg1));
result = (float32) palloc(sizeof(float32data));
*result = val;
return result;
} }
/* /*
* float4um - returns a pointer to -arg1 (unary minus) * float4um - returns -arg1 (unary minus)
*/ */
float32 Datum
float4um(float32 arg1) float4um(PG_FUNCTION_ARGS)
{ {
float32 result; float4 arg1 = PG_GETARG_FLOAT4(0);
double val;
if (!arg1)
return (float32) NULL;
val = ((*arg1 != 0) ? -(*arg1) : *arg1); PG_RETURN_FLOAT4((float4) -arg1);
CheckFloat4Val(val);
result = (float32) palloc(sizeof(float32data));
*result = val;
return result;
} }
float32 Datum
float4larger(float32 arg1, float32 arg2) float4larger(PG_FUNCTION_ARGS)
{ {
float32 result; float4 arg1 = PG_GETARG_FLOAT4(0);
float4 arg2 = PG_GETARG_FLOAT4(1);
if (!arg1 || !arg2) float4 result;
return (float32) NULL;
result = (float32) palloc(sizeof(float32data));
*result = ((*arg1 > *arg2) ? *arg1 : *arg2); result = ((arg1 > arg2) ? arg1 : arg2);
return result; PG_RETURN_FLOAT4(result);
} }
float32 Datum
float4smaller(float32 arg1, float32 arg2) float4smaller(PG_FUNCTION_ARGS)
{ {
float32 result; float4 arg1 = PG_GETARG_FLOAT4(0);
float4 arg2 = PG_GETARG_FLOAT4(1);
if (!arg1 || !arg2) float4 result;
return (float32) NULL;
result = (float32) palloc(sizeof(float32data));
*result = ((*arg1 > *arg2) ? *arg2 : *arg1); result = ((arg1 < arg2) ? arg1 : arg2);
return result; PG_RETURN_FLOAT4(result);
} }
/* /*
...@@ -368,72 +342,58 @@ float4smaller(float32 arg1, float32 arg2) ...@@ -368,72 +342,58 @@ float4smaller(float32 arg1, float32 arg2)
*/ */
/* /*
* float8abs - returns a pointer to |arg1| (absolute value) * float8abs - returns |arg1| (absolute value)
*/ */
float64 Datum
float8abs(float64 arg1) float8abs(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double val; float8 result;
if (!arg1)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data)); result = fabs(arg1);
val = fabs(*arg1); CheckFloat8Val(result);
CheckFloat8Val(val); PG_RETURN_FLOAT8(result);
*result = val;
return result;
} }
/* /*
* float8um - returns a pointer to -arg1 (unary minus) * float8um - returns -arg1 (unary minus)
*/ */
float64 Datum
float8um(float64 arg1) float8um(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double val; float8 result;
if (!arg1)
return (float64) NULL;
val = ((*arg1 != 0) ? -(*arg1) : *arg1); result = ((arg1 != 0) ? -(arg1) : arg1);
CheckFloat8Val(val); CheckFloat8Val(result);
result = (float64) palloc(sizeof(float64data)); PG_RETURN_FLOAT8(result);
*result = val;
return result;
} }
float64 Datum
float8larger(float64 arg1, float64 arg2) float8larger(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
float8 arg2 = PG_GETARG_FLOAT8(1);
if (!arg1 || !arg2) float8 result;
return (float64) NULL;
result = (float64) palloc(sizeof(float64data)); result = ((arg1 > arg2) ? arg1 : arg2);
*result = ((*arg1 > *arg2) ? *arg1 : *arg2); PG_RETURN_FLOAT8(result);
return result;
} }
float64 Datum
float8smaller(float64 arg1, float64 arg2) float8smaller(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
float8 arg2 = PG_GETARG_FLOAT8(1);
if (!arg1 || !arg2) float8 result;
return (float64) NULL;
result = (float64) palloc(sizeof(float64data)); result = ((arg1 < arg2) ? arg1 : arg2);
*result = ((*arg1 > *arg2) ? *arg2 : *arg1); PG_RETURN_FLOAT8(result);
return result;
} }
...@@ -444,158 +404,123 @@ float8smaller(float64 arg1, float64 arg2) ...@@ -444,158 +404,123 @@ float8smaller(float64 arg1, float64 arg2)
*/ */
/* /*
* float4pl - returns a pointer to arg1 + arg2 * float4pl - returns arg1 + arg2
* float4mi - returns a pointer to arg1 - arg2 * float4mi - returns arg1 - arg2
* float4mul - returns a pointer to arg1 * arg2 * float4mul - returns arg1 * arg2
* float4div - returns a pointer to arg1 / arg2 * float4div - returns arg1 / arg2
*/ */
float32 Datum
float4pl(float32 arg1, float32 arg2) float4pl(PG_FUNCTION_ARGS)
{ {
float32 result; float4 arg1 = PG_GETARG_FLOAT4(0);
double val; float4 arg2 = PG_GETARG_FLOAT4(1);
double result;
if (!arg1 || !arg2)
return (float32) NULL;
val = *arg1 + *arg2;
CheckFloat4Val(val);
result = (float32) palloc(sizeof(float32data));
*result = val;
return result; result = arg1 + arg2;
CheckFloat4Val(result);
PG_RETURN_FLOAT4((float4) result);
} }
float32 Datum
float4mi(float32 arg1, float32 arg2) float4mi(PG_FUNCTION_ARGS)
{ {
float32 result; float4 arg1 = PG_GETARG_FLOAT4(0);
double val; float4 arg2 = PG_GETARG_FLOAT4(1);
double result;
if (!arg1 || !arg2)
return (float32) NULL;
val = *arg1 - *arg2;
CheckFloat4Val(val); result = arg1 - arg2;
result = (float32) palloc(sizeof(float32data)); CheckFloat4Val(result);
*result = val; PG_RETURN_FLOAT4((float4) result);
return result;
} }
float32 Datum
float4mul(float32 arg1, float32 arg2) float4mul(PG_FUNCTION_ARGS)
{ {
float32 result; float4 arg1 = PG_GETARG_FLOAT4(0);
double val; float4 arg2 = PG_GETARG_FLOAT4(1);
double result;
if (!arg1 || !arg2)
return (float32) NULL;
val = *arg1 * *arg2;
CheckFloat4Val(val); result = arg1 * arg2;
result = (float32) palloc(sizeof(float32data)); CheckFloat4Val(result);
*result = val; PG_RETURN_FLOAT4((float4) result);
return result;
} }
float32 Datum
float4div(float32 arg1, float32 arg2) float4div(PG_FUNCTION_ARGS)
{ {
float32 result; float4 arg1 = PG_GETARG_FLOAT4(0);
double val; float4 arg2 = PG_GETARG_FLOAT4(1);
double result;
if (!arg1 || !arg2) if (arg2 == 0.0)
return (float32) NULL;
if (*arg2 == 0.0)
elog(ERROR, "float4div: divide by zero error"); elog(ERROR, "float4div: divide by zero error");
val = *arg1 / *arg2; /* Do division in float8, then check for overflow */
result = (float8) arg1 / (float8) arg2;
CheckFloat4Val(val); CheckFloat4Val(result);
result = (float32) palloc(sizeof(float32data)); PG_RETURN_FLOAT4((float4) result);
*result = val;
return result;
} }
/* /*
* float8pl - returns a pointer to arg1 + arg2 * float8pl - returns arg1 + arg2
* float8mi - returns a pointer to arg1 - arg2 * float8mi - returns arg1 - arg2
* float8mul - returns a pointer to arg1 * arg2 * float8mul - returns arg1 * arg2
* float8div - returns a pointer to arg1 / arg2 * float8div - returns arg1 / arg2
*/ */
float64 Datum
float8pl(float64 arg1, float64 arg2) float8pl(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double val; float8 arg2 = PG_GETARG_FLOAT8(1);
float8 result;
if (!arg1 || !arg2)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data)); result = arg1 + arg2;
val = *arg1 + *arg2; CheckFloat8Val(result);
CheckFloat8Val(val); PG_RETURN_FLOAT8(result);
*result = val;
return result;
} }
float64 Datum
float8mi(float64 arg1, float64 arg2) float8mi(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double val; float8 arg2 = PG_GETARG_FLOAT8(1);
float8 result;
if (!arg1 || !arg2)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data)); result = arg1 - arg2;
val = *arg1 - *arg2; CheckFloat8Val(result);
CheckFloat8Val(val); PG_RETURN_FLOAT8(result);
*result = val;
return result;
} }
float64 Datum
float8mul(float64 arg1, float64 arg2) float8mul(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double val; float8 arg2 = PG_GETARG_FLOAT8(1);
float8 result;
if (!arg1 || !arg2)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data)); result = arg1 * arg2;
val = *arg1 * *arg2; CheckFloat8Val(result);
CheckFloat8Val(val); PG_RETURN_FLOAT8(result);
*result = val;
return result;
} }
float64 Datum
float8div(float64 arg1, float64 arg2) float8div(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double val; float8 arg2 = PG_GETARG_FLOAT8(1);
float8 result;
if (!arg1 || !arg2)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
if (*arg2 == 0.0) if (arg2 == 0.0)
elog(ERROR, "float8div: divide by zero error"); elog(ERROR, "float8div: divide by zero error");
val = *arg1 / *arg2; result = arg1 / arg2;
CheckFloat8Val(val);
*result = val; CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} }
...@@ -608,115 +533,115 @@ float8div(float64 arg1, float64 arg2) ...@@ -608,115 +533,115 @@ float8div(float64 arg1, float64 arg2)
/* /*
* float4{eq,ne,lt,le,gt,ge} - float4/float4 comparison operations * float4{eq,ne,lt,le,gt,ge} - float4/float4 comparison operations
*/ */
bool Datum
float4eq(float32 arg1, float32 arg2) float4eq(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 == *arg2; PG_RETURN_BOOL(arg1 == arg2);
} }
bool Datum
float4ne(float32 arg1, float32 arg2) float4ne(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 != *arg2; PG_RETURN_BOOL(arg1 != arg2);
} }
bool Datum
float4lt(float32 arg1, float32 arg2) float4lt(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 < *arg2; PG_RETURN_BOOL(arg1 < arg2);
} }
bool Datum
float4le(float32 arg1, float32 arg2) float4le(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 <= *arg2; PG_RETURN_BOOL(arg1 <= arg2);
} }
bool Datum
float4gt(float32 arg1, float32 arg2) float4gt(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 > *arg2; PG_RETURN_BOOL(arg1 > arg2);
} }
bool Datum
float4ge(float32 arg1, float32 arg2) float4ge(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 >= *arg2; PG_RETURN_BOOL(arg1 >= arg2);
} }
/* /*
* float8{eq,ne,lt,le,gt,ge} - float8/float8 comparison operations * float8{eq,ne,lt,le,gt,ge} - float8/float8 comparison operations
*/ */
bool Datum
float8eq(float64 arg1, float64 arg2) float8eq(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 == *arg2; PG_RETURN_BOOL(arg1 == arg2);
} }
bool Datum
float8ne(float64 arg1, float64 arg2) float8ne(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 != *arg2; PG_RETURN_BOOL(arg1 != arg2);
} }
bool Datum
float8lt(float64 arg1, float64 arg2) float8lt(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 < *arg2; PG_RETURN_BOOL(arg1 < arg2);
} }
bool Datum
float8le(float64 arg1, float64 arg2) float8le(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 <= *arg2; PG_RETURN_BOOL(arg1 <= arg2);
} }
bool Datum
float8gt(float64 arg1, float64 arg2) float8gt(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 > *arg2; PG_RETURN_BOOL(arg1 > arg2);
} }
bool Datum
float8ge(float64 arg1, float64 arg2) float8ge(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 >= *arg2; PG_RETURN_BOOL(arg1 >= arg2);
} }
...@@ -729,57 +654,43 @@ float8ge(float64 arg1, float64 arg2) ...@@ -729,57 +654,43 @@ float8ge(float64 arg1, float64 arg2)
/* /*
* ftod - converts a float4 number to a float8 number * ftod - converts a float4 number to a float8 number
*/ */
float64 Datum
ftod(float32 num) ftod(PG_FUNCTION_ARGS)
{ {
float64 result; float4 num = PG_GETARG_FLOAT4(0);
if (!num)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
*result = *num; PG_RETURN_FLOAT8((float8) num);
return result;
} }
/* /*
* dtof - converts a float8 number to a float4 number * dtof - converts a float8 number to a float4 number
*/ */
float32 Datum
dtof(float64 num) dtof(PG_FUNCTION_ARGS)
{ {
float32 result; float8 num = PG_GETARG_FLOAT8(0);
if (!num)
return (float32) NULL;
CheckFloat4Val(*num);
result = (float32) palloc(sizeof(float32data)); CheckFloat4Val(num);
*result = *num; PG_RETURN_FLOAT4((float4) num);
return result;
} }
/* /*
* dtoi4 - converts a float8 number to an int4 number * dtoi4 - converts a float8 number to an int4 number
*/ */
int32 Datum
dtoi4(float64 num) dtoi4(PG_FUNCTION_ARGS)
{ {
float8 num = PG_GETARG_FLOAT8(0);
int32 result; int32 result;
if (!num) if ((num < INT_MIN) || (num > INT_MAX))
return 0; /* fmgr will return NULL anyway */
if ((*num < INT_MIN) || (*num > INT_MAX))
elog(ERROR, "dtoi4: integer out of range"); elog(ERROR, "dtoi4: integer out of range");
result = rint(*num); result = (int32) rint(num);
return result; PG_RETURN_INT32(result);
} }
...@@ -829,21 +740,19 @@ i2tod(PG_FUNCTION_ARGS) ...@@ -829,21 +740,19 @@ i2tod(PG_FUNCTION_ARGS)
/* /*
* ftoi4 - converts a float8 number to an int4 number * ftoi4 - converts a float4 number to an int4 number
*/ */
int32 Datum
ftoi4(float32 num) ftoi4(PG_FUNCTION_ARGS)
{ {
float4 num = PG_GETARG_FLOAT4(0);
int32 result; int32 result;
if (!num) if ((num < INT_MIN) || (num > INT_MAX))
return 0; /* fmgr will return NULL anyway */
if ((*num < INT_MIN) || (*num > INT_MAX))
elog(ERROR, "ftoi4: integer out of range"); elog(ERROR, "ftoi4: integer out of range");
result = rint(*num); result = (int32) rint(num);
return result; PG_RETURN_INT32(result);
} }
...@@ -903,7 +812,9 @@ float8_text(PG_FUNCTION_ARGS) ...@@ -903,7 +812,9 @@ float8_text(PG_FUNCTION_ARGS)
int len; int len;
char *str; char *str;
str = float8out(&num); /* XXX temporary hack */ str = DatumGetCString(DirectFunctionCall1(float8out,
Float8GetDatum(num)));
len = strlen(str) + VARHDRSZ; len = strlen(str) + VARHDRSZ;
result = (text *) palloc(len); result = (text *) palloc(len);
...@@ -924,7 +835,7 @@ Datum ...@@ -924,7 +835,7 @@ Datum
text_float8(PG_FUNCTION_ARGS) text_float8(PG_FUNCTION_ARGS)
{ {
text *string = PG_GETARG_TEXT_P(0); text *string = PG_GETARG_TEXT_P(0);
float64 result; Datum result;
int len; int len;
char *str; char *str;
...@@ -933,11 +844,11 @@ text_float8(PG_FUNCTION_ARGS) ...@@ -933,11 +844,11 @@ text_float8(PG_FUNCTION_ARGS)
memcpy(str, VARDATA(string), len); memcpy(str, VARDATA(string), len);
*(str + len) = '\0'; *(str + len) = '\0';
result = float8in(str); result = DirectFunctionCall1(float8in, CStringGetDatum(str));
pfree(str); pfree(str);
return PointerGetDatum(result); PG_RETURN_DATUM(result);
} }
...@@ -952,7 +863,9 @@ float4_text(PG_FUNCTION_ARGS) ...@@ -952,7 +863,9 @@ float4_text(PG_FUNCTION_ARGS)
int len; int len;
char *str; char *str;
str = float4out(&num); /* XXX temporary hack */ str = DatumGetCString(DirectFunctionCall1(float4out,
Float4GetDatum(num)));
len = strlen(str) + VARHDRSZ; len = strlen(str) + VARHDRSZ;
result = (text *) palloc(len); result = (text *) palloc(len);
...@@ -973,7 +886,7 @@ Datum ...@@ -973,7 +886,7 @@ Datum
text_float4(PG_FUNCTION_ARGS) text_float4(PG_FUNCTION_ARGS)
{ {
text *string = PG_GETARG_TEXT_P(0); text *string = PG_GETARG_TEXT_P(0);
float32 result; Datum result;
int len; int len;
char *str; char *str;
...@@ -982,11 +895,11 @@ text_float4(PG_FUNCTION_ARGS) ...@@ -982,11 +895,11 @@ text_float4(PG_FUNCTION_ARGS)
memcpy(str, VARDATA(string), len); memcpy(str, VARDATA(string), len);
*(str + len) = '\0'; *(str + len) = '\0';
result = float4in(str); result = DirectFunctionCall1(float4in, CStringGetDatum(str));
pfree(str); pfree(str);
return PointerGetDatum(result); PG_RETURN_DATUM(result);
} }
...@@ -997,143 +910,111 @@ text_float4(PG_FUNCTION_ARGS) ...@@ -997,143 +910,111 @@ text_float4(PG_FUNCTION_ARGS)
*/ */
/* /*
* dround - returns a pointer to ROUND(arg1) * dround - returns ROUND(arg1)
*/ */
float64 Datum
dround(float64 arg1) dround(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!arg1)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data)); result = rint(arg1);
tmp = *arg1; PG_RETURN_FLOAT8(result);
*result = (float64data) rint(tmp);
return result;
} }
/* /*
* dtrunc - returns a pointer to truncation of arg1, * dtrunc - returns truncation-towards-zero of arg1,
* arg1 >= 0 ... the greatest integer as float8 less * arg1 >= 0 ... the greatest integer less
* than or equal to arg1 * than or equal to arg1
* arg1 < 0 ... the greatest integer as float8 greater * arg1 < 0 ... the least integer greater
* than or equal to arg1 * than or equal to arg1
*/ */
float64 Datum
dtrunc(float64 arg1) dtrunc(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!arg1)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1; if (arg1 >= 0)
if (*arg1 >= 0) result = floor(arg1);
*result = (float64data) floor(tmp);
else else
*result = (float64data) -(floor(-tmp)); result = -floor(-arg1);
return result;
PG_RETURN_FLOAT8(result);
} }
/* /*
* dsqrt - returns a pointer to square root of arg1 * dsqrt - returns square root of arg1
*/ */
float64 Datum
dsqrt(float64 arg1) dsqrt(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!arg1) if (arg1 < 0)
return (float64) NULL; elog(ERROR, "can't take sqrt of a negative number");
result = (float64) palloc(sizeof(float64data)); result = sqrt(arg1);
tmp = *arg1; CheckFloat8Val(result);
*result = (float64data) sqrt(tmp); PG_RETURN_FLOAT8(result);
return result;
} }
/* /*
* dcbrt - returns a pointer to cube root of arg1 * dcbrt - returns cube root of arg1
*/ */
float64 Datum
dcbrt(float64 arg1) dcbrt(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!arg1)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1; result = cbrt(arg1);
*result = (float64data) cbrt(tmp); PG_RETURN_FLOAT8(result);
return result;
} }
/* /*
* dpow - returns a pointer to pow(arg1,arg2) * dpow - returns pow(arg1,arg2)
*/ */
float64 Datum
dpow(float64 arg1, float64 arg2) dpow(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp1, float8 arg2 = PG_GETARG_FLOAT8(1);
tmp2; float8 result;
if (!arg1 || !arg2)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp1 = *arg1;
tmp2 = *arg2;
/* /*
* We must check both for errno getting set and for a NaN result, in * We must check both for errno getting set and for a NaN result, in
* order to deal with the vagaries of different platforms... * order to deal with the vagaries of different platforms...
*/ */
errno = 0; errno = 0;
*result = (float64data) pow(tmp1, tmp2); result = pow(arg1, arg2);
if (errno != 0 if (errno != 0
#ifdef HAVE_FINITE #ifdef HAVE_FINITE
|| !finite(*result) || !finite(result)
#endif #endif
) )
elog(ERROR, "pow() result is out of range"); elog(ERROR, "pow() result is out of range");
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} }
/* /*
* dexp - returns a pointer to the exponential function of arg1 * dexp - returns the exponential function of arg1
*/ */
float64 Datum
dexp(float64 arg1) dexp(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!arg1)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1;
/* /*
* We must check both for errno getting set and for a NaN result, in * We must check both for errno getting set and for a NaN result, in
...@@ -1141,395 +1022,318 @@ dexp(float64 arg1) ...@@ -1141,395 +1022,318 @@ dexp(float64 arg1)
* zero result implies unreported underflow. * zero result implies unreported underflow.
*/ */
errno = 0; errno = 0;
*result = (float64data) exp(tmp); result = exp(arg1);
if (errno != 0 || *result == 0.0 if (errno != 0 || result == 0.0
#ifdef HAVE_FINITE #ifdef HAVE_FINITE
|| !finite(*result) || !finite(result)
#endif #endif
) )
elog(ERROR, "exp() result is out of range"); elog(ERROR, "exp() result is out of range");
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} }
/* /*
* dlog1 - returns a pointer to the natural logarithm of arg1 * dlog1 - returns the natural logarithm of arg1
* ("dlog" is already a logging routine...) * ("dlog" is already a logging routine...)
*/ */
float64 Datum
dlog1(float64 arg1) dlog1(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!PointerIsValid(arg1))
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1; if (arg1 == 0.0)
if (tmp == 0.0)
elog(ERROR, "can't take log of zero"); elog(ERROR, "can't take log of zero");
if (tmp < 0) if (arg1 < 0)
elog(ERROR, "can't take log of a negative number"); elog(ERROR, "can't take log of a negative number");
*result = (float64data) log(tmp);
CheckFloat8Val(*result); result = log(arg1);
return result;
} /* dlog1() */ CheckFloat8Val(result);
PG_RETURN_FLOAT8(result);
}
/* /*
* dlog10 - returns a pointer to the base 10 logarithm of arg1 * dlog10 - returns the base 10 logarithm of arg1
*/ */
float64 Datum
dlog10(float64 arg1) dlog10(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!PointerIsValid(arg1))
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1; if (arg1 == 0.0)
if (tmp == 0.0)
elog(ERROR, "can't take log of zero"); elog(ERROR, "can't take log of zero");
if (tmp < 0) if (arg1 < 0)
elog(ERROR, "can't take log of a negative number"); elog(ERROR, "can't take log of a negative number");
*result = (float64data) log10(tmp);
CheckFloat8Val(*result); result = log10(arg1);
return result;
} /* dlog10() */ CheckFloat8Val(result);
PG_RETURN_FLOAT8(result);
}
/* /*
* dacos - returns a pointer to the arccos of arg1 (radians) * dacos - returns the arccos of arg1 (radians)
*/ */
float64 Datum
dacos(float64 arg1) dacos(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!PointerIsValid(arg1))
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1;
errno = 0; errno = 0;
*result = (float64data) acos(tmp); result = acos(arg1);
if (errno != 0 if (errno != 0
#ifdef HAVE_FINITE #ifdef HAVE_FINITE
|| !finite(*result) || !finite(result)
#endif #endif
) )
elog(ERROR, "dacos(%f) input is out of range", *arg1); elog(ERROR, "acos(%f) input is out of range", arg1);
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} /* dacos() */ }
/* /*
* dasin - returns a pointer to the arcsin of arg1 (radians) * dasin - returns the arcsin of arg1 (radians)
*/ */
float64 Datum
dasin(float64 arg1) dasin(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!PointerIsValid(arg1))
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1;
errno = 0; errno = 0;
*result = (float64data) asin(tmp); result = asin(arg1);
if (errno != 0 if (errno != 0
#ifdef HAVE_FINITE #ifdef HAVE_FINITE
|| !finite(*result) || !finite(result)
#endif #endif
) )
elog(ERROR, "dasin(%f) input is out of range", *arg1); elog(ERROR, "asin(%f) input is out of range", arg1);
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} /* dasin() */ }
/* /*
* datan - returns a pointer to the arctan of arg1 (radians) * datan - returns the arctan of arg1 (radians)
*/ */
float64 Datum
datan(float64 arg1) datan(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!PointerIsValid(arg1))
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1;
errno = 0; errno = 0;
*result = (float64data) atan(tmp); result = atan(arg1);
if (errno != 0 if (errno != 0
#ifdef HAVE_FINITE #ifdef HAVE_FINITE
|| !finite(*result) || !finite(result)
#endif #endif
) )
elog(ERROR, "atan(%f) input is out of range", *arg1); elog(ERROR, "atan(%f) input is out of range", arg1);
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} /* datan() */ }
/* /*
* atan2 - returns a pointer to the arctan2 of arg1 (radians) * atan2 - returns the arctan2 of arg1 (radians)
*/ */
float64 Datum
datan2(float64 arg1, float64 arg2) datan2(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
float8 arg2 = PG_GETARG_FLOAT8(1);
if (!PointerIsValid(arg1) || !PointerIsValid(arg1)) float8 result;
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
errno = 0; errno = 0;
*result = (float64data) atan2(*arg1, *arg2); result = atan2(arg1, arg2);
if (errno != 0 if (errno != 0
#ifdef HAVE_FINITE #ifdef HAVE_FINITE
|| !finite(*result) || !finite(result)
#endif #endif
) )
elog(ERROR, "atan2(%f,%f) input is out of range", *arg1, *arg2); elog(ERROR, "atan2(%f,%f) input is out of range", arg1, arg2);
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} /* datan2() */ }
/* /*
* dcos - returns a pointer to the cosine of arg1 (radians) * dcos - returns the cosine of arg1 (radians)
*/ */
float64 Datum
dcos(float64 arg1) dcos(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!PointerIsValid(arg1))
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1;
errno = 0; errno = 0;
*result = (float64data) cos(tmp); result = cos(arg1);
if (errno != 0 if (errno != 0
#ifdef HAVE_FINITE #ifdef HAVE_FINITE
|| !finite(*result) || !finite(result)
#endif #endif
) )
elog(ERROR, "dcos(%f) input is out of range", *arg1); elog(ERROR, "cos(%f) input is out of range", arg1);
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} /* dcos() */ }
/* /*
* dcot - returns a pointer to the cotangent of arg1 (radians) * dcot - returns the cotangent of arg1 (radians)
*/ */
float64 Datum
dcot(float64 arg1) dcot(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!PointerIsValid(arg1))
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1;
errno = 0; errno = 0;
*result = (float64data) tan(tmp); result = tan(arg1);
if ((errno != 0) || (*result == 0.0) if (errno != 0 || result == 0.0
#ifdef HAVE_FINITE #ifdef HAVE_FINITE
|| !finite(*result) || !finite(result)
#endif #endif
) )
elog(ERROR, "dcot(%f) input is out of range", *arg1); elog(ERROR, "cot(%f) input is out of range", arg1);
*result = 1.0 / (*result); result = 1.0 / result;
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} /* dcot() */ }
/* /*
* dsin - returns a pointer to the sine of arg1 (radians) * dsin - returns the sine of arg1 (radians)
*/ */
float64 Datum
dsin(float64 arg1) dsin(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!PointerIsValid(arg1))
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1;
errno = 0; errno = 0;
*result = (float64data) sin(tmp); result = sin(arg1);
if (errno != 0 if (errno != 0
#ifdef HAVE_FINITE #ifdef HAVE_FINITE
|| !finite(*result) || !finite(result)
#endif #endif
) )
elog(ERROR, "dsin(%f) input is out of range", *arg1); elog(ERROR, "sin(%f) input is out of range", arg1);
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} /* dsin() */ }
/* /*
* dtan - returns a pointer to the tangent of arg1 (radians) * dtan - returns the tangent of arg1 (radians)
*/ */
float64 Datum
dtan(float64 arg1) dtan(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
double tmp; float8 result;
if (!PointerIsValid(arg1))
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
tmp = *arg1;
errno = 0; errno = 0;
*result = (float64data) tan(tmp); result = tan(arg1);
if (errno != 0 if (errno != 0
#ifdef HAVE_FINITE #ifdef HAVE_FINITE
|| !finite(*result) || !finite(result)
#endif #endif
) )
elog(ERROR, "dtan(%f) input is out of range", *arg1); elog(ERROR, "tan(%f) input is out of range", arg1);
CheckFloat8Val(*result);
return result;
} /* dtan() */
CheckFloat8Val(result);
#ifndef M_PI PG_RETURN_FLOAT8(result);
/* from my RH5.2 gcc math.h file - thomas 2000-04-03 */ }
#define M_PI 3.14159265358979323846
#endif
/* /*
* degrees - returns a pointer to degrees converted from radians * degrees - returns degrees converted from radians
*/ */
float64 Datum
degrees(float64 arg1) degrees(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
float8 result;
if (!arg1)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
*result = ((*arg1) * (180.0 / M_PI)); result = arg1 * (180.0 / M_PI);
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} /* degrees() */ }
/* /*
* dpi - returns a pointer to degrees converted to radians * dpi - returns the constant PI
*/ */
float64 Datum
dpi(void) dpi(PG_FUNCTION_ARGS)
{ {
float64 result; PG_RETURN_FLOAT8(M_PI);
}
result = (float64) palloc(sizeof(float64data));
*result = (M_PI);
return result;
} /* dpi() */
/* /*
* radians - returns a pointer to radians converted from degrees * radians - returns radians converted from degrees
*/ */
float64 Datum
radians(float64 arg1) radians(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
float8 result;
if (!arg1)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
*result = ((*arg1) * (M_PI / 180.0)); result = arg1 * (M_PI / 180.0);
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} /* radians() */ }
/* /*
* drandom - returns a random number * drandom - returns a random number
*/ */
float64 Datum
drandom(void) drandom(PG_FUNCTION_ARGS)
{ {
float64 result; float8 result;
result = (float64) palloc(sizeof(float64data));
/* result 0.0-1.0 */ /* result 0.0-1.0 */
*result = (((double) random()) / RAND_MAX); result = ((double) random()) / RAND_MAX;
CheckFloat8Val(*result); PG_RETURN_FLOAT8(result);
return result; }
} /* drandom() */
/* /*
* setseed - set seed for the random number generator * setseed - set seed for the random number generator
*/ */
int32 Datum
setseed(float64 seed) setseed(PG_FUNCTION_ARGS)
{ {
int iseed = ((*seed) * RAND_MAX); float8 seed = PG_GETARG_FLOAT8(0);
int iseed = (seed * RAND_MAX);
srandom((unsigned int) ((*seed) * RAND_MAX)); srandom((unsigned int) iseed);
return iseed; PG_RETURN_INT32(iseed);
} /* setseed() */ }
...@@ -1710,142 +1514,121 @@ float8_stddev(PG_FUNCTION_ARGS) ...@@ -1710,142 +1514,121 @@ float8_stddev(PG_FUNCTION_ARGS)
*/ */
/* /*
* float48pl - returns a pointer to arg1 + arg2 * float48pl - returns arg1 + arg2
* float48mi - returns a pointer to arg1 - arg2 * float48mi - returns arg1 - arg2
* float48mul - returns a pointer to arg1 * arg2 * float48mul - returns arg1 * arg2
* float48div - returns a pointer to arg1 / arg2 * float48div - returns arg1 / arg2
*/ */
float64 Datum
float48pl(float32 arg1, float64 arg2) float48pl(PG_FUNCTION_ARGS)
{ {
float64 result; float4 arg1 = PG_GETARG_FLOAT4(0);
float8 arg2 = PG_GETARG_FLOAT8(1);
if (!arg1 || !arg2) float8 result;
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
*result = *arg1 + *arg2; result = arg1 + arg2;
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} }
float64 Datum
float48mi(float32 arg1, float64 arg2) float48mi(PG_FUNCTION_ARGS)
{ {
float64 result; float4 arg1 = PG_GETARG_FLOAT4(0);
float8 arg2 = PG_GETARG_FLOAT8(1);
if (!arg1 || !arg2) float8 result;
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
*result = *arg1 - *arg2; result = arg1 - arg2;
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} }
float64 Datum
float48mul(float32 arg1, float64 arg2) float48mul(PG_FUNCTION_ARGS)
{ {
float64 result; float4 arg1 = PG_GETARG_FLOAT4(0);
float8 arg2 = PG_GETARG_FLOAT8(1);
if (!arg1 || !arg2) float8 result;
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
*result = *arg1 * *arg2; result = arg1 * arg2;
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} }
float64 Datum
float48div(float32 arg1, float64 arg2) float48div(PG_FUNCTION_ARGS)
{ {
float64 result; float4 arg1 = PG_GETARG_FLOAT4(0);
float8 arg2 = PG_GETARG_FLOAT8(1);
if (!arg1 || !arg2) float8 result;
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
if (*arg2 == 0.0) if (arg2 == 0.0)
elog(ERROR, "float48div: divide by zero"); elog(ERROR, "float48div: divide by zero");
*result = *arg1 / *arg2; result = arg1 / arg2;
CheckFloat8Val(*result); CheckFloat8Val(result);
return result; PG_RETURN_FLOAT8(result);
} }
/* /*
* float84pl - returns a pointer to arg1 + arg2 * float84pl - returns arg1 + arg2
* float84mi - returns a pointer to arg1 - arg2 * float84mi - returns arg1 - arg2
* float84mul - returns a pointer to arg1 * arg2 * float84mul - returns arg1 * arg2
* float84div - returns a pointer to arg1 / arg2 * float84div - returns arg1 / arg2
*/ */
float64 Datum
float84pl(float64 arg1, float32 arg2) float84pl(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
float4 arg2 = PG_GETARG_FLOAT4(1);
if (!arg1 || !arg2) float8 result;
return (float64) NULL;
result = (float64) palloc(sizeof(float64data)); result = arg1 + arg2;
*result = *arg1 + *arg2; CheckFloat8Val(result);
CheckFloat8Val(*result); PG_RETURN_FLOAT8(result);
return result;
} }
float64 Datum
float84mi(float64 arg1, float32 arg2) float84mi(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
float4 arg2 = PG_GETARG_FLOAT4(1);
if (!arg1 || !arg2) float8 result;
return (float64) NULL;
result = (float64) palloc(sizeof(float64data)); result = arg1 - arg2;
*result = *arg1 - *arg2; CheckFloat8Val(result);
CheckFloat8Val(*result); PG_RETURN_FLOAT8(result);
return result;
} }
float64 Datum
float84mul(float64 arg1, float32 arg2) float84mul(PG_FUNCTION_ARGS)
{ {
float8 arg1 = PG_GETARG_FLOAT8(0);
float4 arg2 = PG_GETARG_FLOAT4(1);
float8 result;
float64 result; result = arg1 * arg2;
if (!arg1 || !arg2)
return (float64) NULL;
result = (float64) palloc(sizeof(float64data));
*result = *arg1 * *arg2; CheckFloat8Val(result);
CheckFloat8Val(*result); PG_RETURN_FLOAT8(result);
return result;
} }
float64 Datum
float84div(float64 arg1, float32 arg2) float84div(PG_FUNCTION_ARGS)
{ {
float64 result; float8 arg1 = PG_GETARG_FLOAT8(0);
float4 arg2 = PG_GETARG_FLOAT4(1);
if (!arg1 || !arg2) float8 result;
return (float64) NULL;
result = (float64) palloc(sizeof(float64data)); if (arg2 == 0.0)
elog(ERROR, "float84div: divide by zero");
if (*arg2 == 0.0) result = arg1 / arg2;
elog(ERROR, "float48div: divide by zero");
*result = *arg1 / *arg2; CheckFloat8Val(result);
CheckFloat8Val(*result); PG_RETURN_FLOAT8(result);
return result;
} }
/* /*
...@@ -1857,115 +1640,115 @@ float84div(float64 arg1, float32 arg2) ...@@ -1857,115 +1640,115 @@ float84div(float64 arg1, float32 arg2)
/* /*
* float48{eq,ne,lt,le,gt,ge} - float4/float8 comparison operations * float48{eq,ne,lt,le,gt,ge} - float4/float8 comparison operations
*/ */
bool Datum
float48eq(float32 arg1, float64 arg2) float48eq(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 == *arg2; PG_RETURN_BOOL(arg1 == arg2);
} }
bool Datum
float48ne(float32 arg1, float64 arg2) float48ne(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 != *arg2; PG_RETURN_BOOL(arg1 != arg2);
} }
bool Datum
float48lt(float32 arg1, float64 arg2) float48lt(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 < *arg2; PG_RETURN_BOOL(arg1 < arg2);
} }
bool Datum
float48le(float32 arg1, float64 arg2) float48le(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 <= *arg2; PG_RETURN_BOOL(arg1 <= arg2);
} }
bool Datum
float48gt(float32 arg1, float64 arg2) float48gt(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 > *arg2; PG_RETURN_BOOL(arg1 > arg2);
} }
bool Datum
float48ge(float32 arg1, float64 arg2) float48ge(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float4 arg1 = PG_GETARG_FLOAT4(0);
return 0; float8 arg2 = PG_GETARG_FLOAT8(1);
return *arg1 >= *arg2; PG_RETURN_BOOL(arg1 >= arg2);
} }
/* /*
* float84{eq,ne,lt,le,gt,ge} - float4/float8 comparison operations * float84{eq,ne,lt,le,gt,ge} - float8/float4 comparison operations
*/ */
bool Datum
float84eq(float64 arg1, float32 arg2) float84eq(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 == *arg2; PG_RETURN_BOOL(arg1 == arg2);
} }
bool Datum
float84ne(float64 arg1, float32 arg2) float84ne(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 != *arg2; PG_RETURN_BOOL(arg1 != arg2);
} }
bool Datum
float84lt(float64 arg1, float32 arg2) float84lt(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 < *arg2; PG_RETURN_BOOL(arg1 < arg2);
} }
bool Datum
float84le(float64 arg1, float32 arg2) float84le(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 <= *arg2; PG_RETURN_BOOL(arg1 <= arg2);
} }
bool Datum
float84gt(float64 arg1, float32 arg2) float84gt(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 > *arg2; PG_RETURN_BOOL(arg1 > arg2);
} }
bool Datum
float84ge(float64 arg1, float32 arg2) float84ge(PG_FUNCTION_ARGS)
{ {
if (!arg1 || !arg2) float8 arg1 = PG_GETARG_FLOAT8(0);
return 0; float4 arg2 = PG_GETARG_FLOAT4(1);
return *arg1 >= *arg2; PG_RETURN_BOOL(arg1 >= arg2);
} }
/* ========== PRIVATE ROUTINES ========== */ /* ========== PRIVATE ROUTINES ========== */
...@@ -1996,26 +1779,14 @@ float84ge(float64 arg1, float32 arg2) ...@@ -1996,26 +1779,14 @@ float84ge(float64 arg1, float32 arg2)
* Inexact flag raised if x not equal to rint(x). * Inexact flag raised if x not equal to rint(x).
*/ */
#ifdef __STDC__ static const double one = 1.0,
static const double
#else
static double
#endif
one = 1.0,
TWO52[2] = { TWO52[2] = {
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15,/* 0xC3300000, 0x00000000 */ -4.50359962737049600000e+15,/* 0xC3300000, 0x00000000 */
}; };
#ifdef __STDC__
static double static double
rint(double x) rint(double x)
#else
static double
rint(x)
double x;
#endif
{ {
int i0, int i0,
n0, n0,
...@@ -2088,10 +1859,8 @@ double x; ...@@ -2088,10 +1859,8 @@ double x;
#ifndef HAVE_CBRT #ifndef HAVE_CBRT
static static double
double cbrt(double x)
cbrt(x)
double x;
{ {
int isneg = (x < 0.0); int isneg = (x < 0.0);
double tmpres = pow(fabs(x), (double) 1.0 / (double) 3.0); double tmpres = pow(fabs(x), (double) 1.0 / (double) 3.0);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.41 2000/07/17 03:05:17 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.42 2000/08/01 18:29:35 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -65,7 +65,7 @@ int2out(PG_FUNCTION_ARGS) ...@@ -65,7 +65,7 @@ int2out(PG_FUNCTION_ARGS)
int16 arg1 = PG_GETARG_INT16(0); int16 arg1 = PG_GETARG_INT16(0);
char *result = (char *) palloc(7); /* sign, 5 digits, '\0' */ char *result = (char *) palloc(7); /* sign, 5 digits, '\0' */
itoa((int) arg1, result); pg_itoa(arg1, result);
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }
...@@ -123,7 +123,7 @@ int2vectorout(PG_FUNCTION_ARGS) ...@@ -123,7 +123,7 @@ int2vectorout(PG_FUNCTION_ARGS)
{ {
if (num != 0) if (num != 0)
*rp++ = ' '; *rp++ = ' ';
ltoa(int2Array[num], rp); pg_itoa(int2Array[num], rp);
while (*++rp != '\0') while (*++rp != '\0')
; ;
} }
...@@ -187,7 +187,7 @@ int44out(PG_FUNCTION_ARGS) ...@@ -187,7 +187,7 @@ int44out(PG_FUNCTION_ARGS)
walk = result; walk = result;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
itoa(an_array[i], walk); pg_ltoa(an_array[i], walk);
while (*++walk != '\0') while (*++walk != '\0')
; ;
*walk++ = ' '; *walk++ = ' ';
...@@ -221,7 +221,7 @@ int4out(PG_FUNCTION_ARGS) ...@@ -221,7 +221,7 @@ int4out(PG_FUNCTION_ARGS)
int32 arg1 = PG_GETARG_INT32(0); int32 arg1 = PG_GETARG_INT32(0);
char *result = (char *) palloc(12); /* sign, 10 digits, '\0' */ char *result = (char *) palloc(12); /* sign, 10 digits, '\0' */
ltoa(arg1, result); pg_ltoa(arg1, result);
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }
...@@ -259,7 +259,7 @@ int2_text(PG_FUNCTION_ARGS) ...@@ -259,7 +259,7 @@ int2_text(PG_FUNCTION_ARGS)
int16 arg1 = PG_GETARG_INT16(0); int16 arg1 = PG_GETARG_INT16(0);
text *result = (text *) palloc(7+VARHDRSZ); /* sign,5 digits, '\0' */ text *result = (text *) palloc(7+VARHDRSZ); /* sign,5 digits, '\0' */
itoa((int) arg1, VARDATA(result)); pg_itoa(arg1, VARDATA(result));
VARATT_SIZEP(result) = strlen(VARDATA(result)) + VARHDRSZ; VARATT_SIZEP(result) = strlen(VARDATA(result)) + VARHDRSZ;
PG_RETURN_TEXT_P(result); PG_RETURN_TEXT_P(result);
} }
...@@ -290,7 +290,7 @@ int4_text(PG_FUNCTION_ARGS) ...@@ -290,7 +290,7 @@ int4_text(PG_FUNCTION_ARGS)
int32 arg1 = PG_GETARG_INT32(0); int32 arg1 = PG_GETARG_INT32(0);
text *result = (text *) palloc(12+VARHDRSZ); /* sign,10 digits,'\0' */ text *result = (text *) palloc(12+VARHDRSZ); /* sign,10 digits,'\0' */
ltoa(arg1, VARDATA(result)); pg_ltoa(arg1, VARDATA(result));
VARATT_SIZEP(result) = strlen(VARDATA(result)) + VARHDRSZ; VARATT_SIZEP(result) = strlen(VARDATA(result)) + VARHDRSZ;
PG_RETURN_TEXT_P(result); PG_RETURN_TEXT_P(result);
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* 1998 Jan Wieck * 1998 Jan Wieck
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.33 2000/07/29 03:26:41 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.34 2000/08/01 18:29:35 tgl Exp $
* *
* ---------- * ----------
*/ */
...@@ -1766,17 +1766,19 @@ numeric_float8(PG_FUNCTION_ARGS) ...@@ -1766,17 +1766,19 @@ numeric_float8(PG_FUNCTION_ARGS)
{ {
Numeric num = PG_GETARG_NUMERIC(0); Numeric num = PG_GETARG_NUMERIC(0);
char *tmp; char *tmp;
float64 result; Datum result;
if (NUMERIC_IS_NAN(num)) if (NUMERIC_IS_NAN(num))
PG_RETURN_FLOAT8(NAN); PG_RETURN_FLOAT8(NAN);
tmp = DatumGetCString(DirectFunctionCall1(numeric_out, tmp = DatumGetCString(DirectFunctionCall1(numeric_out,
NumericGetDatum(num))); NumericGetDatum(num)));
result = float8in(tmp);
result = DirectFunctionCall1(float8in, CStringGetDatum(tmp));
pfree(tmp); pfree(tmp);
PG_RETURN_POINTER(result); PG_RETURN_DATUM(result);
} }
...@@ -1809,17 +1811,19 @@ numeric_float4(PG_FUNCTION_ARGS) ...@@ -1809,17 +1811,19 @@ numeric_float4(PG_FUNCTION_ARGS)
{ {
Numeric num = PG_GETARG_NUMERIC(0); Numeric num = PG_GETARG_NUMERIC(0);
char *tmp; char *tmp;
float32 result; Datum result;
if (NUMERIC_IS_NAN(num)) if (NUMERIC_IS_NAN(num))
PG_RETURN_FLOAT4(NAN); PG_RETURN_FLOAT4((float4) NAN);
tmp = DatumGetCString(DirectFunctionCall1(numeric_out, tmp = DatumGetCString(DirectFunctionCall1(numeric_out,
NumericGetDatum(num))); NumericGetDatum(num)));
result = float4in(tmp);
result = DirectFunctionCall1(float4in, CStringGetDatum(tmp));
pfree(tmp); pfree(tmp);
PG_RETURN_POINTER(result); PG_RETURN_DATUM(result);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* numutils.c * numutils.c
* utility functions for I/O of built-in numeric types. * utility functions for I/O of built-in numeric types.
* *
* integer: itoa, ltoa * integer: pg_itoa, pg_ltoa
* floating point: ftoa, atof1 * floating point: ftoa, atof1
* *
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.41 2000/07/12 22:59:09 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.42 2000/08/01 18:29:35 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -116,27 +116,27 @@ pg_atoi(char *s, int size, int c) ...@@ -116,27 +116,27 @@ pg_atoi(char *s, int size, int c)
} }
/* /*
* itoa - converts a short int to its string represention * pg_itoa - converts a short int to its string represention
* *
* Note: * Note:
* previously based on ~ingres/source/gutil/atoi.c * previously based on ~ingres/source/gutil/atoi.c
* now uses vendor's sprintf conversion * now uses vendor's sprintf conversion
*/ */
void void
itoa(int i, char *a) pg_itoa(int16 i, char *a)
{ {
sprintf(a, "%hd", (short) i); sprintf(a, "%hd", (short) i);
} }
/* /*
* ltoa - converts a long int to its string represention * pg_ltoa - converts a long int to its string represention
* *
* Note: * Note:
* previously based on ~ingres/source/gutil/atoi.c * previously based on ~ingres/source/gutil/atoi.c
* now uses vendor's sprintf conversion * now uses vendor's sprintf conversion
*/ */
void void
ltoa(int32 l, char *a) pg_ltoa(int32 l, char *a)
{ {
sprintf(a, "%d", l); sprintf(a, "%d", l);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.37 2000/07/03 23:09:52 wieck Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.38 2000/08/01 18:29:35 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -79,7 +79,7 @@ oidvectorout(PG_FUNCTION_ARGS) ...@@ -79,7 +79,7 @@ oidvectorout(PG_FUNCTION_ARGS)
{ {
if (num != 0) if (num != 0)
*rp++ = ' '; *rp++ = ' ';
ltoa(oidArray[num], rp); pg_ltoa((int32) oidArray[num], rp);
while (*++rp != '\0') while (*++rp != '\0')
; ;
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_proc.h,v 1.154 2000/07/31 22:39:05 tgl Exp $ * $Id: pg_proc.h,v 1.155 2000/08/01 18:29:30 tgl Exp $
* *
* NOTES * NOTES
* The script catalog/genbki.sh reads this file and generates .bki * The script catalog/genbki.sh reads this file and generates .bki
...@@ -365,13 +365,13 @@ DESCR("modulus"); ...@@ -365,13 +365,13 @@ DESCR("modulus");
DATA(insert OID = 175 ( int42mod PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100 int42mod - )); DATA(insert OID = 175 ( int42mod PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100 int42mod - ));
DESCR("modulus"); DESCR("modulus");
DATA(insert OID = 176 ( int2pl PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100 int2pl - )); DATA(insert OID = 176 ( int2pl PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100 int2pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 177 ( int4pl PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100 int4pl - )); DATA(insert OID = 177 ( int4pl PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100 int4pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 178 ( int24pl PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100 int24pl - )); DATA(insert OID = 178 ( int24pl PGUID 12 f t t t 2 f 23 "21 23" 100 0 0 100 int24pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 179 ( int42pl PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100 int42pl - )); DATA(insert OID = 179 ( int42pl PGUID 12 f t t t 2 f 23 "23 21" 100 0 0 100 int42pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 180 ( int2mi PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100 int2mi - )); DATA(insert OID = 180 ( int2mi PGUID 12 f t t t 2 f 21 "21 21" 100 0 0 100 int2mi - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 181 ( int4mi PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100 int4mi - )); DATA(insert OID = 181 ( int4mi PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100 int4mi - ));
...@@ -415,27 +415,27 @@ DESCR("r-tree"); ...@@ -415,27 +415,27 @@ DESCR("r-tree");
/* OIDS 200 - 299 */ /* OIDS 200 - 299 */
DATA(insert OID = 200 ( float4in PGUID 11 f t t t 1 f 700 "0" 100 0 0 100 float4in - )); DATA(insert OID = 200 ( float4in PGUID 12 f t t t 1 f 700 "0" 100 0 0 100 float4in - ));
DESCR("(internal)"); DESCR("(internal)");
DATA(insert OID = 201 ( float4out PGUID 11 f t t t 1 f 23 "0" 100 0 0 100 float4out - )); DATA(insert OID = 201 ( float4out PGUID 12 f t t t 1 f 23 "700" 100 0 0 100 float4out - ));
DESCR("(internal)"); DESCR("(internal)");
DATA(insert OID = 202 ( float4mul PGUID 11 f t t t 2 f 700 "700 700" 100 0 0 100 float4mul - )); DATA(insert OID = 202 ( float4mul PGUID 12 f t t t 2 f 700 "700 700" 100 0 0 100 float4mul - ));
DESCR("multiply"); DESCR("multiply");
DATA(insert OID = 203 ( float4div PGUID 11 f t t t 2 f 700 "700 700" 100 0 0 100 float4div - )); DATA(insert OID = 203 ( float4div PGUID 12 f t t t 2 f 700 "700 700" 100 0 0 100 float4div - ));
DESCR("divide"); DESCR("divide");
DATA(insert OID = 204 ( float4pl PGUID 11 f t t t 2 f 700 "700 700" 100 0 0 100 float4pl - )); DATA(insert OID = 204 ( float4pl PGUID 12 f t t t 2 f 700 "700 700" 100 0 0 100 float4pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 205 ( float4mi PGUID 11 f t t t 2 f 700 "700 700" 100 0 0 100 float4mi - )); DATA(insert OID = 205 ( float4mi PGUID 12 f t t t 2 f 700 "700 700" 100 0 0 100 float4mi - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 206 ( float4um PGUID 11 f t t t 1 f 700 "700" 100 0 0 100 float4um - )); DATA(insert OID = 206 ( float4um PGUID 12 f t t t 1 f 700 "700" 100 0 0 100 float4um - ));
DESCR("negate"); DESCR("negate");
DATA(insert OID = 207 ( float4abs PGUID 11 f t t t 1 f 700 "700" 100 0 0 100 float4abs - )); DATA(insert OID = 207 ( float4abs PGUID 12 f t t t 1 f 700 "700" 100 0 0 100 float4abs - ));
DESCR("absolute value"); DESCR("absolute value");
DATA(insert OID = 208 ( float4_accum PGUID 12 f t t t 2 f 1022 "1022 700" 100 0 0 100 float4_accum - )); DATA(insert OID = 208 ( float4_accum PGUID 12 f t t t 2 f 1022 "1022 700" 100 0 0 100 float4_accum - ));
DESCR("aggregate transition function"); DESCR("aggregate transition function");
DATA(insert OID = 209 ( float4larger PGUID 11 f t t t 2 f 700 "700 700" 100 0 0 100 float4larger - )); DATA(insert OID = 209 ( float4larger PGUID 12 f t t t 2 f 700 "700 700" 100 0 0 100 float4larger - ));
DESCR("larger of two"); DESCR("larger of two");
DATA(insert OID = 211 ( float4smaller PGUID 11 f t t t 2 f 700 "700 700" 100 0 0 100 float4smaller - )); DATA(insert OID = 211 ( float4smaller PGUID 12 f t t t 2 f 700 "700 700" 100 0 0 100 float4smaller - ));
DESCR("smaller of two"); DESCR("smaller of two");
DATA(insert OID = 212 ( int4um PGUID 12 f t t t 1 f 23 "23" 100 0 0 100 int4um - )); DATA(insert OID = 212 ( int4um PGUID 12 f t t t 1 f 23 "23" 100 0 0 100 int4um - ));
...@@ -443,27 +443,27 @@ DESCR("negate"); ...@@ -443,27 +443,27 @@ DESCR("negate");
DATA(insert OID = 213 ( int2um PGUID 12 f t t t 1 f 21 "21" 100 0 0 100 int2um - )); DATA(insert OID = 213 ( int2um PGUID 12 f t t t 1 f 21 "21" 100 0 0 100 int2um - ));
DESCR("negate"); DESCR("negate");
DATA(insert OID = 214 ( float8in PGUID 11 f t t t 1 f 701 "0" 100 0 0 100 float8in - )); DATA(insert OID = 214 ( float8in PGUID 12 f t t t 1 f 701 "0" 100 0 0 100 float8in - ));
DESCR("(internal)"); DESCR("(internal)");
DATA(insert OID = 215 ( float8out PGUID 11 f t t t 1 f 23 "0" 100 0 0 100 float8out - )); DATA(insert OID = 215 ( float8out PGUID 12 f t t t 1 f 23 "701" 100 0 0 100 float8out - ));
DESCR("(internal)"); DESCR("(internal)");
DATA(insert OID = 216 ( float8mul PGUID 11 f t t t 2 f 701 "701 701" 100 0 0 100 float8mul - )); DATA(insert OID = 216 ( float8mul PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100 float8mul - ));
DESCR("multiply"); DESCR("multiply");
DATA(insert OID = 217 ( float8div PGUID 11 f t t t 2 f 701 "701 701" 100 0 0 100 float8div - )); DATA(insert OID = 217 ( float8div PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100 float8div - ));
DESCR("divide"); DESCR("divide");
DATA(insert OID = 218 ( float8pl PGUID 11 f t t t 2 f 701 "701 701" 100 0 0 100 float8pl - )); DATA(insert OID = 218 ( float8pl PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100 float8pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 219 ( float8mi PGUID 11 f t t t 2 f 701 "701 701" 100 0 0 100 float8mi - )); DATA(insert OID = 219 ( float8mi PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100 float8mi - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 220 ( float8um PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 float8um - )); DATA(insert OID = 220 ( float8um PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 float8um - ));
DESCR("negate"); DESCR("negate");
DATA(insert OID = 221 ( float8abs PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 float8abs - )); DATA(insert OID = 221 ( float8abs PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 float8abs - ));
DESCR("absolute value"); DESCR("absolute value");
DATA(insert OID = 222 ( float8_accum PGUID 12 f t t t 2 f 1022 "1022 701" 100 0 0 100 float8_accum - )); DATA(insert OID = 222 ( float8_accum PGUID 12 f t t t 2 f 1022 "1022 701" 100 0 0 100 float8_accum - ));
DESCR("aggregate transition function"); DESCR("aggregate transition function");
DATA(insert OID = 223 ( float8larger PGUID 11 f t t t 2 f 701 "701 701" 100 0 0 100 float8larger - )); DATA(insert OID = 223 ( float8larger PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100 float8larger - ));
DESCR("larger of two"); DESCR("larger of two");
DATA(insert OID = 224 ( float8smaller PGUID 11 f t t t 2 f 701 "701 701" 100 0 0 100 float8smaller - )); DATA(insert OID = 224 ( float8smaller PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100 float8smaller - ));
DESCR("smaller of two"); DESCR("smaller of two");
DATA(insert OID = 225 ( lseg_center PGUID 12 f t t t 1 f 600 "601" 100 0 0 100 lseg_center - )); DATA(insert OID = 225 ( lseg_center PGUID 12 f t t t 1 f 600 "601" 100 0 0 100 lseg_center - ));
...@@ -473,19 +473,19 @@ DESCR("center of"); ...@@ -473,19 +473,19 @@ DESCR("center of");
DATA(insert OID = 227 ( poly_center PGUID 12 f t t t 1 f 600 "604" 100 0 0 100 poly_center - )); DATA(insert OID = 227 ( poly_center PGUID 12 f t t t 1 f 600 "604" 100 0 0 100 poly_center - ));
DESCR("center of"); DESCR("center of");
DATA(insert OID = 228 ( dround PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dround - )); DATA(insert OID = 228 ( dround PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dround - ));
DESCR("round to integer"); DESCR("round to nearest integer");
DATA(insert OID = 229 ( dtrunc PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dtrunc - )); DATA(insert OID = 229 ( dtrunc PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dtrunc - ));
DESCR("truncate to integer"); DESCR("truncate to integer");
DATA(insert OID = 230 ( dsqrt PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dsqrt - )); DATA(insert OID = 230 ( dsqrt PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dsqrt - ));
DESCR("square root"); DESCR("square root");
DATA(insert OID = 231 ( dcbrt PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dcbrt - )); DATA(insert OID = 231 ( dcbrt PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dcbrt - ));
DESCR("cube root"); DESCR("cube root");
DATA(insert OID = 232 ( dpow PGUID 11 f t t t 2 f 701 "701 701" 100 0 0 100 dpow - )); DATA(insert OID = 232 ( dpow PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100 dpow - ));
DESCR("exponentiation (x^y)"); DESCR("exponentiation (x^y)");
DATA(insert OID = 233 ( dexp PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dexp - )); DATA(insert OID = 233 ( dexp PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dexp - ));
DESCR("natural exponential (e^x)"); DESCR("natural exponential (e^x)");
DATA(insert OID = 234 ( dlog1 PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dlog1 - )); DATA(insert OID = 234 ( dlog1 PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dlog1 - ));
DESCR("natural logarithm"); DESCR("natural logarithm");
DATA(insert OID = 235 ( float8 PGUID 12 f t t t 1 f 701 "21" 100 0 0 100 i2tod - )); DATA(insert OID = 235 ( float8 PGUID 12 f t t t 1 f 701 "21" 100 0 0 100 i2tod - ));
DESCR("convert int2 to float8"); DESCR("convert int2 to float8");
...@@ -507,7 +507,7 @@ DESCR("(internal)"); ...@@ -507,7 +507,7 @@ DESCR("(internal)");
DATA(insert OID = 243 ( reltimeout PGUID 12 f t f t 1 f 23 "0" 100 0 0 100 reltimeout - )); DATA(insert OID = 243 ( reltimeout PGUID 12 f t f t 1 f 23 "0" 100 0 0 100 reltimeout - ));
DESCR("(internal)"); DESCR("(internal)");
DATA(insert OID = 244 ( timepl PGUID 12 f t f t 2 f 702 "702 703" 100 0 0 100 timepl - )); DATA(insert OID = 244 ( timepl PGUID 12 f t f t 2 f 702 "702 703" 100 0 0 100 timepl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 245 ( timemi PGUID 12 f t f t 2 f 702 "702 703" 100 0 0 100 timemi - )); DATA(insert OID = 245 ( timemi PGUID 12 f t f t 2 f 702 "702 703" 100 0 0 100 timemi - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 246 ( tintervalin PGUID 12 f t f t 1 f 704 "0" 100 0 0 100 tintervalin - )); DATA(insert OID = 246 ( tintervalin PGUID 12 f t f t 1 f 704 "0" 100 0 0 100 tintervalin - ));
...@@ -579,80 +579,80 @@ DESCR(""); ...@@ -579,80 +579,80 @@ DESCR("");
DATA(insert OID = 278 ( inter_lb PGUID 12 f t t t 2 f 16 "628 603" 100 0 0 100 inter_lb - )); DATA(insert OID = 278 ( inter_lb PGUID 12 f t t t 2 f 16 "628 603" 100 0 0 100 inter_lb - ));
DESCR(""); DESCR("");
DATA(insert OID = 279 ( float48mul PGUID 11 f t t t 2 f 701 "700 701" 100 0 0 100 float48mul - )); DATA(insert OID = 279 ( float48mul PGUID 12 f t t t 2 f 701 "700 701" 100 0 0 100 float48mul - ));
DESCR("multiply"); DESCR("multiply");
DATA(insert OID = 280 ( float48div PGUID 11 f t t t 2 f 701 "700 701" 100 0 0 100 float48div - )); DATA(insert OID = 280 ( float48div PGUID 12 f t t t 2 f 701 "700 701" 100 0 0 100 float48div - ));
DESCR("divide"); DESCR("divide");
DATA(insert OID = 281 ( float48pl PGUID 11 f t t t 2 f 701 "700 701" 100 0 0 100 float48pl - )); DATA(insert OID = 281 ( float48pl PGUID 12 f t t t 2 f 701 "700 701" 100 0 0 100 float48pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 282 ( float48mi PGUID 11 f t t t 2 f 701 "700 701" 100 0 0 100 float48mi - )); DATA(insert OID = 282 ( float48mi PGUID 12 f t t t 2 f 701 "700 701" 100 0 0 100 float48mi - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 283 ( float84mul PGUID 11 f t t t 2 f 701 "701 700" 100 0 0 100 float84mul - )); DATA(insert OID = 283 ( float84mul PGUID 12 f t t t 2 f 701 "701 700" 100 0 0 100 float84mul - ));
DESCR("multiply"); DESCR("multiply");
DATA(insert OID = 284 ( float84div PGUID 11 f t t t 2 f 701 "701 700" 100 0 0 100 float84div - )); DATA(insert OID = 284 ( float84div PGUID 12 f t t t 2 f 701 "701 700" 100 0 0 100 float84div - ));
DESCR("divide"); DESCR("divide");
DATA(insert OID = 285 ( float84pl PGUID 11 f t t t 2 f 701 "701 700" 100 0 0 100 float84pl - )); DATA(insert OID = 285 ( float84pl PGUID 12 f t t t 2 f 701 "701 700" 100 0 0 100 float84pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 286 ( float84mi PGUID 11 f t t t 2 f 701 "701 700" 100 0 0 100 float84mi - )); DATA(insert OID = 286 ( float84mi PGUID 12 f t t t 2 f 701 "701 700" 100 0 0 100 float84mi - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 287 ( float4eq PGUID 11 f t t t 2 f 16 "700 700" 100 0 0 100 float4eq - )); DATA(insert OID = 287 ( float4eq PGUID 12 f t t t 2 f 16 "700 700" 100 0 0 100 float4eq - ));
DESCR("equal"); DESCR("equal");
DATA(insert OID = 288 ( float4ne PGUID 11 f t t t 2 f 16 "700 700" 100 0 0 100 float4ne - )); DATA(insert OID = 288 ( float4ne PGUID 12 f t t t 2 f 16 "700 700" 100 0 0 100 float4ne - ));
DESCR("not equal"); DESCR("not equal");
DATA(insert OID = 289 ( float4lt PGUID 11 f t t t 2 f 16 "700 700" 100 0 0 100 float4lt - )); DATA(insert OID = 289 ( float4lt PGUID 12 f t t t 2 f 16 "700 700" 100 0 0 100 float4lt - ));
DESCR("less-than"); DESCR("less-than");
DATA(insert OID = 290 ( float4le PGUID 11 f t t t 2 f 16 "700 700" 100 0 0 100 float4le - )); DATA(insert OID = 290 ( float4le PGUID 12 f t t t 2 f 16 "700 700" 100 0 0 100 float4le - ));
DESCR("less-than-or-equal"); DESCR("less-than-or-equal");
DATA(insert OID = 291 ( float4gt PGUID 11 f t t t 2 f 16 "700 700" 100 0 0 100 float4gt - )); DATA(insert OID = 291 ( float4gt PGUID 12 f t t t 2 f 16 "700 700" 100 0 0 100 float4gt - ));
DESCR("greater-than"); DESCR("greater-than");
DATA(insert OID = 292 ( float4ge PGUID 11 f t t t 2 f 16 "700 700" 100 0 0 100 float4ge - )); DATA(insert OID = 292 ( float4ge PGUID 12 f t t t 2 f 16 "700 700" 100 0 0 100 float4ge - ));
DESCR("greater-than-or-equal"); DESCR("greater-than-or-equal");
DATA(insert OID = 293 ( float8eq PGUID 11 f t t t 2 f 16 "701 701" 100 0 0 100 float8eq - )); DATA(insert OID = 293 ( float8eq PGUID 12 f t t t 2 f 16 "701 701" 100 0 0 100 float8eq - ));
DESCR("equal"); DESCR("equal");
DATA(insert OID = 294 ( float8ne PGUID 11 f t t t 2 f 16 "701 701" 100 0 0 100 float8ne - )); DATA(insert OID = 294 ( float8ne PGUID 12 f t t t 2 f 16 "701 701" 100 0 0 100 float8ne - ));
DESCR("not equal"); DESCR("not equal");
DATA(insert OID = 295 ( float8lt PGUID 11 f t t t 2 f 16 "701 701" 100 0 0 100 float8lt - )); DATA(insert OID = 295 ( float8lt PGUID 12 f t t t 2 f 16 "701 701" 100 0 0 100 float8lt - ));
DESCR("less-than"); DESCR("less-than");
DATA(insert OID = 296 ( float8le PGUID 11 f t t t 2 f 16 "701 701" 100 0 0 100 float8le - )); DATA(insert OID = 296 ( float8le PGUID 12 f t t t 2 f 16 "701 701" 100 0 0 100 float8le - ));
DESCR("less-than-or-equal"); DESCR("less-than-or-equal");
DATA(insert OID = 297 ( float8gt PGUID 11 f t t t 2 f 16 "701 701" 100 0 0 100 float8gt - )); DATA(insert OID = 297 ( float8gt PGUID 12 f t t t 2 f 16 "701 701" 100 0 0 100 float8gt - ));
DESCR("greater-than"); DESCR("greater-than");
DATA(insert OID = 298 ( float8ge PGUID 11 f t t t 2 f 16 "701 701" 100 0 0 100 float8ge - )); DATA(insert OID = 298 ( float8ge PGUID 12 f t t t 2 f 16 "701 701" 100 0 0 100 float8ge - ));
DESCR("greater-than-or-equal"); DESCR("greater-than-or-equal");
DATA(insert OID = 299 ( float48eq PGUID 11 f t t t 2 f 16 "700 701" 100 0 0 100 float48eq - )); DATA(insert OID = 299 ( float48eq PGUID 12 f t t t 2 f 16 "700 701" 100 0 0 100 float48eq - ));
DESCR("equal"); DESCR("equal");
/* OIDS 300 - 399 */ /* OIDS 300 - 399 */
DATA(insert OID = 300 ( float48ne PGUID 11 f t t t 2 f 16 "700 701" 100 0 0 100 float48ne - )); DATA(insert OID = 300 ( float48ne PGUID 12 f t t t 2 f 16 "700 701" 100 0 0 100 float48ne - ));
DESCR("not equal"); DESCR("not equal");
DATA(insert OID = 301 ( float48lt PGUID 11 f t t t 2 f 16 "700 701" 100 0 0 100 float48lt - )); DATA(insert OID = 301 ( float48lt PGUID 12 f t t t 2 f 16 "700 701" 100 0 0 100 float48lt - ));
DESCR("less-than"); DESCR("less-than");
DATA(insert OID = 302 ( float48le PGUID 11 f t t t 2 f 16 "700 701" 100 0 0 100 float48le - )); DATA(insert OID = 302 ( float48le PGUID 12 f t t t 2 f 16 "700 701" 100 0 0 100 float48le - ));
DESCR("less-than-or-equal"); DESCR("less-than-or-equal");
DATA(insert OID = 303 ( float48gt PGUID 11 f t t t 2 f 16 "700 701" 100 0 0 100 float48gt - )); DATA(insert OID = 303 ( float48gt PGUID 12 f t t t 2 f 16 "700 701" 100 0 0 100 float48gt - ));
DESCR("greater-than"); DESCR("greater-than");
DATA(insert OID = 304 ( float48ge PGUID 11 f t t t 2 f 16 "700 701" 100 0 0 100 float48ge - )); DATA(insert OID = 304 ( float48ge PGUID 12 f t t t 2 f 16 "700 701" 100 0 0 100 float48ge - ));
DESCR("greater-than-or-equal"); DESCR("greater-than-or-equal");
DATA(insert OID = 305 ( float84eq PGUID 11 f t t t 2 f 16 "701 700" 100 0 0 100 float84eq - )); DATA(insert OID = 305 ( float84eq PGUID 12 f t t t 2 f 16 "701 700" 100 0 0 100 float84eq - ));
DESCR("equal"); DESCR("equal");
DATA(insert OID = 306 ( float84ne PGUID 11 f t t t 2 f 16 "701 700" 100 0 0 100 float84ne - )); DATA(insert OID = 306 ( float84ne PGUID 12 f t t t 2 f 16 "701 700" 100 0 0 100 float84ne - ));
DESCR("not equal"); DESCR("not equal");
DATA(insert OID = 307 ( float84lt PGUID 11 f t t t 2 f 16 "701 700" 100 0 0 100 float84lt - )); DATA(insert OID = 307 ( float84lt PGUID 12 f t t t 2 f 16 "701 700" 100 0 0 100 float84lt - ));
DESCR("less-than"); DESCR("less-than");
DATA(insert OID = 308 ( float84le PGUID 11 f t t t 2 f 16 "701 700" 100 0 0 100 float84le - )); DATA(insert OID = 308 ( float84le PGUID 12 f t t t 2 f 16 "701 700" 100 0 0 100 float84le - ));
DESCR("less-than-or-equal"); DESCR("less-than-or-equal");
DATA(insert OID = 309 ( float84gt PGUID 11 f t t t 2 f 16 "701 700" 100 0 0 100 float84gt - )); DATA(insert OID = 309 ( float84gt PGUID 12 f t t t 2 f 16 "701 700" 100 0 0 100 float84gt - ));
DESCR("greater-than"); DESCR("greater-than");
DATA(insert OID = 310 ( float84ge PGUID 11 f t t t 2 f 16 "701 700" 100 0 0 100 float84ge - )); DATA(insert OID = 310 ( float84ge PGUID 12 f t t t 2 f 16 "701 700" 100 0 0 100 float84ge - ));
DESCR("greater-than-or-equal"); DESCR("greater-than-or-equal");
DATA(insert OID = 311 ( float8 PGUID 11 f t t t 1 f 701 "700" 100 0 0 100 ftod - )); DATA(insert OID = 311 ( float8 PGUID 12 f t t t 1 f 701 "700" 100 0 0 100 ftod - ));
DESCR("convert float4 to float8"); DESCR("convert float4 to float8");
DATA(insert OID = 312 ( float4 PGUID 11 f t t t 1 f 700 "701" 100 0 0 100 dtof - )); DATA(insert OID = 312 ( float4 PGUID 12 f t t t 1 f 700 "701" 100 0 0 100 dtof - ));
DESCR("convert float8 to float4"); DESCR("convert float8 to float4");
DATA(insert OID = 313 ( int4 PGUID 12 f t t t 1 f 23 "21" 100 0 0 100 i2toi4 - )); DATA(insert OID = 313 ( int4 PGUID 12 f t t t 1 f 23 "21" 100 0 0 100 i2toi4 - ));
DESCR("convert int2 to int4"); DESCR("convert int2 to int4");
...@@ -662,11 +662,11 @@ DATA(insert OID = 315 ( int2vectoreq PGUID 12 f t t t 2 f 16 "22 22" 100 0 ...@@ -662,11 +662,11 @@ DATA(insert OID = 315 ( int2vectoreq PGUID 12 f t t t 2 f 16 "22 22" 100 0
DESCR("equal"); DESCR("equal");
DATA(insert OID = 316 ( float8 PGUID 12 f t t t 1 f 701 "23" 100 0 0 100 i4tod - )); DATA(insert OID = 316 ( float8 PGUID 12 f t t t 1 f 701 "23" 100 0 0 100 i4tod - ));
DESCR("convert int4 to float8"); DESCR("convert int4 to float8");
DATA(insert OID = 317 ( int4 PGUID 11 f t t t 1 f 23 "701" 100 0 0 100 dtoi4 - )); DATA(insert OID = 317 ( int4 PGUID 12 f t t t 1 f 23 "701" 100 0 0 100 dtoi4 - ));
DESCR("convert float8 to int4"); DESCR("convert float8 to int4");
DATA(insert OID = 318 ( float4 PGUID 12 f t t t 1 f 700 "23" 100 0 0 100 i4tof - )); DATA(insert OID = 318 ( float4 PGUID 12 f t t t 1 f 700 "23" 100 0 0 100 i4tof - ));
DESCR("convert int4 to float4"); DESCR("convert int4 to float4");
DATA(insert OID = 319 ( int4 PGUID 11 f t t t 1 f 23 "700" 100 0 0 100 ftoi4 - )); DATA(insert OID = 319 ( int4 PGUID 12 f t t t 1 f 23 "700" 100 0 0 100 ftoi4 - ));
DESCR("convert float4 to int4"); DESCR("convert float4 to int4");
DATA(insert OID = 320 ( rtinsert PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100 rtinsert - )); DATA(insert OID = 320 ( rtinsert PGUID 12 f t f t 5 f 23 "0 0 0 0 0" 100 0 0 100 rtinsert - ));
...@@ -842,9 +842,9 @@ DESCR("(internal)"); ...@@ -842,9 +842,9 @@ DESCR("(internal)");
DATA(insert OID = 462 ( int8um PGUID 12 f t t t 1 f 20 "20" 100 0 0 100 int8um - )); DATA(insert OID = 462 ( int8um PGUID 12 f t t t 1 f 20 "20" 100 0 0 100 int8um - ));
DESCR("negate"); DESCR("negate");
DATA(insert OID = 463 ( int8pl PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100 int8pl - )); DATA(insert OID = 463 ( int8pl PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100 int8pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 464 ( int8mi PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100 int8mi - )); DATA(insert OID = 464 ( int8mi PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100 int8mi - ));
DESCR("subtraction"); DESCR("subtract");
DATA(insert OID = 465 ( int8mul PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100 int8mul - )); DATA(insert OID = 465 ( int8mul PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100 int8mul - ));
DESCR("multiply"); DESCR("multiply");
DATA(insert OID = 466 ( int8div PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100 int8div - )); DATA(insert OID = 466 ( int8div PGUID 12 f t t t 2 f 20 "20 20" 100 0 0 100 int8div - ));
...@@ -1058,11 +1058,11 @@ DESCR("convert float8 to text"); ...@@ -1058,11 +1058,11 @@ DESCR("convert float8 to text");
DATA(insert OID = 841 ( text PGUID 12 f t t t 1 f 25 "700" 100 0 0 100 float4_text -)); DATA(insert OID = 841 ( text PGUID 12 f t t t 1 f 25 "700" 100 0 0 100 float4_text -));
DESCR("convert float4 to text"); DESCR("convert float4 to text");
DATA(insert OID = 846 ( cash_mul_flt4 PGUID 11 f t t t 2 f 790 "790 700" 100 0 0 100 cash_mul_flt4 - )); DATA(insert OID = 846 ( cash_mul_flt4 PGUID 12 f t t t 2 f 790 "790 700" 100 0 0 100 cash_mul_flt4 - ));
DESCR("multiply"); DESCR("multiply");
DATA(insert OID = 847 ( cash_div_flt4 PGUID 11 f t t t 2 f 790 "790 700" 100 0 0 100 cash_div_flt4 - )); DATA(insert OID = 847 ( cash_div_flt4 PGUID 12 f t t t 2 f 790 "790 700" 100 0 0 100 cash_div_flt4 - ));
DESCR("divide"); DESCR("divide");
DATA(insert OID = 848 ( flt4_mul_cash PGUID 11 f t t t 2 f 790 "700 790" 100 0 0 100 flt4_mul_cash - )); DATA(insert OID = 848 ( flt4_mul_cash PGUID 12 f t t t 2 f 790 "700 790" 100 0 0 100 flt4_mul_cash - ));
DESCR("multiply"); DESCR("multiply");
DATA(insert OID = 849 ( position PGUID 12 f t t t 2 f 23 "25 25" 100 0 1 0 textpos - )); DATA(insert OID = 849 ( position PGUID 12 f t t t 2 f 23 "25 25" 100 0 1 0 textpos - ));
...@@ -1127,19 +1127,19 @@ DESCR("greater-than"); ...@@ -1127,19 +1127,19 @@ DESCR("greater-than");
DATA(insert OID = 893 ( cash_ge PGUID 11 f t t t 2 f 16 "790 790" 100 0 0 100 cash_ge - )); DATA(insert OID = 893 ( cash_ge PGUID 11 f t t t 2 f 16 "790 790" 100 0 0 100 cash_ge - ));
DESCR("greater-than-or-equal"); DESCR("greater-than-or-equal");
DATA(insert OID = 894 ( cash_pl PGUID 11 f t t t 2 f 790 "790 790" 100 0 0 100 cash_pl - )); DATA(insert OID = 894 ( cash_pl PGUID 11 f t t t 2 f 790 "790 790" 100 0 0 100 cash_pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 895 ( cash_mi PGUID 11 f t t t 2 f 790 "790 790" 100 0 0 100 cash_mi - )); DATA(insert OID = 895 ( cash_mi PGUID 11 f t t t 2 f 790 "790 790" 100 0 0 100 cash_mi - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 896 ( cash_mul_flt8 PGUID 11 f t t t 2 f 790 "790 701" 100 0 0 100 cash_mul_flt8 - )); DATA(insert OID = 896 ( cash_mul_flt8 PGUID 12 f t t t 2 f 790 "790 701" 100 0 0 100 cash_mul_flt8 - ));
DESCR("multiply"); DESCR("multiply");
DATA(insert OID = 897 ( cash_div_flt8 PGUID 11 f t t t 2 f 790 "790 701" 100 0 0 100 cash_div_flt8 - )); DATA(insert OID = 897 ( cash_div_flt8 PGUID 12 f t t t 2 f 790 "790 701" 100 0 0 100 cash_div_flt8 - ));
DESCR("divide"); DESCR("divide");
DATA(insert OID = 898 ( cashlarger PGUID 11 f t t t 2 f 790 "790 790" 100 0 0 100 cashlarger - )); DATA(insert OID = 898 ( cashlarger PGUID 11 f t t t 2 f 790 "790 790" 100 0 0 100 cashlarger - ));
DESCR("larger of two"); DESCR("larger of two");
DATA(insert OID = 899 ( cashsmaller PGUID 11 f t t t 2 f 790 "790 790" 100 0 0 100 cashsmaller - )); DATA(insert OID = 899 ( cashsmaller PGUID 11 f t t t 2 f 790 "790 790" 100 0 0 100 cashsmaller - ));
DESCR("smaller of two"); DESCR("smaller of two");
DATA(insert OID = 919 ( flt8_mul_cash PGUID 11 f t t t 2 f 790 "701 790" 100 0 0 100 flt8_mul_cash - )); DATA(insert OID = 919 ( flt8_mul_cash PGUID 12 f t t t 2 f 790 "701 790" 100 0 0 100 flt8_mul_cash - ));
DESCR("multiply"); DESCR("multiply");
/* OIDS 900 - 999 */ /* OIDS 900 - 999 */
...@@ -1348,7 +1348,7 @@ DESCR("smaller of two"); ...@@ -1348,7 +1348,7 @@ DESCR("smaller of two");
DATA(insert OID = 1140 ( date_mi PGUID 12 f t t t 2 f 23 "1082 1082" 100 0 0 100 date_mi - )); DATA(insert OID = 1140 ( date_mi PGUID 12 f t t t 2 f 23 "1082 1082" 100 0 0 100 date_mi - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 1141 ( date_pli PGUID 12 f t t t 2 f 1082 "1082 23" 100 0 0 100 date_pli - )); DATA(insert OID = 1141 ( date_pli PGUID 12 f t t t 2 f 1082 "1082 23" 100 0 0 100 date_pli - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 1142 ( date_mii PGUID 12 f t t t 2 f 1082 "1082 23" 100 0 0 100 date_mii - )); DATA(insert OID = 1142 ( date_mii PGUID 12 f t t t 2 f 1082 "1082 23" 100 0 0 100 date_mii - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 1143 ( time_in PGUID 12 f t f t 1 f 1083 "0" 100 0 0 100 time_in - )); DATA(insert OID = 1143 ( time_in PGUID 12 f t f t 1 f 1083 "0" 100 0 0 100 time_in - ));
...@@ -1359,7 +1359,7 @@ DATA(insert OID = 1145 ( time_eq PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 ...@@ -1359,7 +1359,7 @@ DATA(insert OID = 1145 ( time_eq PGUID 12 f t t t 2 f 16 "1083 1083" 100 0
DESCR("equal"); DESCR("equal");
DATA(insert OID = 1146 ( circle_add_pt PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100 circle_add_pt - )); DATA(insert OID = 1146 ( circle_add_pt PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100 circle_add_pt - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 1147 ( circle_sub_pt PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100 circle_sub_pt - )); DATA(insert OID = 1147 ( circle_sub_pt PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100 circle_sub_pt - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 1148 ( circle_mul_pt PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100 circle_mul_pt - )); DATA(insert OID = 1148 ( circle_mul_pt PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100 circle_mul_pt - ));
...@@ -1405,7 +1405,7 @@ DESCR("greater-than"); ...@@ -1405,7 +1405,7 @@ DESCR("greater-than");
DATA(insert OID = 1168 ( interval_um PGUID 12 f t f t 1 f 1186 "1186" 100 0 0 100 interval_um - )); DATA(insert OID = 1168 ( interval_um PGUID 12 f t f t 1 f 1186 "1186" 100 0 0 100 interval_um - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 1169 ( interval_pl PGUID 12 f t f t 2 f 1186 "1186 1186" 100 0 0 100 interval_pl - )); DATA(insert OID = 1169 ( interval_pl PGUID 12 f t f t 2 f 1186 "1186 1186" 100 0 0 100 interval_pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 1170 ( interval_mi PGUID 12 f t f t 2 f 1186 "1186 1186" 100 0 0 100 interval_mi - )); DATA(insert OID = 1170 ( interval_mi PGUID 12 f t f t 2 f 1186 "1186 1186" 100 0 0 100 interval_mi - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 1171 ( date_part PGUID 12 f t f t 2 f 701 "25 1184" 100 0 0 100 timestamp_part - )); DATA(insert OID = 1171 ( date_part PGUID 12 f t f t 2 f 701 "25 1184" 100 0 0 100 timestamp_part - ));
...@@ -1494,17 +1494,17 @@ DATA(insert OID = 1272 ( datetime_pl PGUID 12 f t f t 2 f 1184 "1082 1083" 1 ...@@ -1494,17 +1494,17 @@ DATA(insert OID = 1272 ( datetime_pl PGUID 12 f t f t 2 f 1184 "1082 1083" 1
DESCR("convert date and time to timestamp"); DESCR("convert date and time to timestamp");
DATA(insert OID = 1274 ( int84pl PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int84pl - )); DATA(insert OID = 1274 ( int84pl PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int84pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 1275 ( int84mi PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int84mi - )); DATA(insert OID = 1275 ( int84mi PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int84mi - ));
DESCR("subtraction"); DESCR("subtract");
DATA(insert OID = 1276 ( int84mul PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int84mul - )); DATA(insert OID = 1276 ( int84mul PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int84mul - ));
DESCR("multiply"); DESCR("multiply");
DATA(insert OID = 1277 ( int84div PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int84div - )); DATA(insert OID = 1277 ( int84div PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int84div - ));
DESCR("divide"); DESCR("divide");
DATA(insert OID = 1278 ( int48pl PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100 int48pl - )); DATA(insert OID = 1278 ( int48pl PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100 int48pl - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 1279 ( int48mi PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100 int48mi - )); DATA(insert OID = 1279 ( int48mi PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100 int48mi - ));
DESCR("subtraction"); DESCR("subtract");
DATA(insert OID = 1280 ( int48mul PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100 int48mul - )); DATA(insert OID = 1280 ( int48mul PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100 int48mul - ));
DESCR("multiply"); DESCR("multiply");
DATA(insert OID = 1281 ( int48div PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100 int48div - )); DATA(insert OID = 1281 ( int48div PGUID 12 f t t t 2 f 20 "23 20" 100 0 0 100 int48div - ));
...@@ -1582,23 +1582,23 @@ DESCR("character length"); ...@@ -1582,23 +1582,23 @@ DESCR("character length");
DATA(insert OID = 1326 ( interval_div PGUID 12 f t f t 2 f 1186 "1186 701" 100 0 0 100 interval_div - )); DATA(insert OID = 1326 ( interval_div PGUID 12 f t f t 2 f 1186 "1186 701" 100 0 0 100 interval_div - ));
DESCR("divide"); DESCR("divide");
DATA(insert OID = 1339 ( dlog10 PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dlog10 - )); DATA(insert OID = 1339 ( dlog10 PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dlog10 - ));
DESCR("base 10 logarithm"); DESCR("base 10 logarithm");
DATA(insert OID = 1340 ( log PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dlog10 - )); DATA(insert OID = 1340 ( log PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dlog10 - ));
DESCR("base 10 logarithm"); DESCR("base 10 logarithm");
DATA(insert OID = 1341 ( ln PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dlog1 - )); DATA(insert OID = 1341 ( ln PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dlog1 - ));
DESCR("natural logarithm"); DESCR("natural logarithm");
DATA(insert OID = 1342 ( round PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dround - )); DATA(insert OID = 1342 ( round PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dround - ));
DESCR("round to integral part"); DESCR("round to nearest integer");
DATA(insert OID = 1343 ( trunc PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dtrunc - )); DATA(insert OID = 1343 ( trunc PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dtrunc - ));
DESCR("truncate to integral part"); DESCR("truncate to integer");
DATA(insert OID = 1344 ( sqrt PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dsqrt - )); DATA(insert OID = 1344 ( sqrt PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dsqrt - ));
DESCR("square root"); DESCR("square root");
DATA(insert OID = 1345 ( cbrt PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dcbrt - )); DATA(insert OID = 1345 ( cbrt PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dcbrt - ));
DESCR("cube root"); DESCR("cube root");
DATA(insert OID = 1346 ( pow PGUID 11 f t t t 2 f 701 "701 701" 100 0 0 100 dpow - )); DATA(insert OID = 1346 ( pow PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100 dpow - ));
DESCR("exponentiation"); DESCR("exponentiation");
DATA(insert OID = 1347 ( exp PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dexp - )); DATA(insert OID = 1347 ( exp PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dexp - ));
DESCR("exponential"); DESCR("exponential");
DATA(insert OID = 1348 ( obj_description PGUID 14 f t f t 1 f 25 "26" 100 0 0 100 "select description from pg_description where objoid = $1" - )); DATA(insert OID = 1348 ( obj_description PGUID 14 f t f t 1 f 25 "26" 100 0 0 100 "select description from pg_description where objoid = $1" - ));
...@@ -1696,9 +1696,9 @@ DATA(insert OID = 1392 ( factorial PGUID 12 f t t t 1 f 23 "23" 100 0 0 100 ...@@ -1696,9 +1696,9 @@ DATA(insert OID = 1392 ( factorial PGUID 12 f t t t 1 f 23 "23" 100 0 0 100
DESCR("factorial"); DESCR("factorial");
DATA(insert OID = 1393 ( factorial PGUID 12 f t t t 1 f 20 "20" 100 0 0 100 int8fac - )); DATA(insert OID = 1393 ( factorial PGUID 12 f t t t 1 f 20 "20" 100 0 0 100 int8fac - ));
DESCR("factorial"); DESCR("factorial");
DATA(insert OID = 1394 ( abs PGUID 11 f t t t 1 f 700 "700" 100 0 0 100 float4abs - )); DATA(insert OID = 1394 ( abs PGUID 12 f t t t 1 f 700 "700" 100 0 0 100 float4abs - ));
DESCR("absolute value"); DESCR("absolute value");
DATA(insert OID = 1395 ( abs PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 float8abs - )); DATA(insert OID = 1395 ( abs PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 float8abs - ));
DESCR("absolute value"); DESCR("absolute value");
DATA(insert OID = 1396 ( abs PGUID 12 f t t t 1 f 20 "20" 100 0 0 100 int8abs - )); DATA(insert OID = 1396 ( abs PGUID 12 f t t t 1 f 20 "20" 100 0 0 100 int8abs - ));
DESCR("absolute value"); DESCR("absolute value");
...@@ -1993,34 +1993,34 @@ DESCR("less than"); ...@@ -1993,34 +1993,34 @@ DESCR("less than");
DATA(insert OID = 1596 ( bitcmp PGUID 11 f t t t 2 f 23 "1560 1560" 100 0 1 0 bitcmp - )); DATA(insert OID = 1596 ( bitcmp PGUID 11 f t t t 2 f 23 "1560 1560" 100 0 1 0 bitcmp - ));
DESCR("compare"); DESCR("compare");
DATA(insert OID = 1598 ( random PGUID 11 f t f t 0 f 701 "0" 100 0 0 100 drandom - )); DATA(insert OID = 1598 ( random PGUID 12 f t f t 0 f 701 "0" 100 0 0 100 drandom - ));
DESCR("radians to degrees"); DESCR("random value");
DATA(insert OID = 1599 ( setseed PGUID 11 f t t t 1 f 23 "701" 100 0 0 100 setseed - )); DATA(insert OID = 1599 ( setseed PGUID 12 f t f t 1 f 23 "701" 100 0 0 100 setseed - ));
DESCR("radians to degrees"); DESCR("set random seed");
/* OIDS 1600 - 1699 */ /* OIDS 1600 - 1699 */
DATA(insert OID = 1600 ( asin PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dasin - )); DATA(insert OID = 1600 ( asin PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dasin - ));
DESCR("arcsine"); DESCR("arcsine");
DATA(insert OID = 1601 ( acos PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dacos - )); DATA(insert OID = 1601 ( acos PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dacos - ));
DESCR("arcsine"); DESCR("arccosine");
DATA(insert OID = 1602 ( atan PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 datan - )); DATA(insert OID = 1602 ( atan PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 datan - ));
DESCR("arctangent"); DESCR("arctangent");
DATA(insert OID = 1603 ( atan2 PGUID 11 f t t t 2 f 701 "701 701" 100 0 0 100 datan2 - )); DATA(insert OID = 1603 ( atan2 PGUID 12 f t t t 2 f 701 "701 701" 100 0 0 100 datan2 - ));
DESCR("arctangent, two arguments"); DESCR("arctangent, two arguments");
DATA(insert OID = 1604 ( sin PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dsin - )); DATA(insert OID = 1604 ( sin PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dsin - ));
DESCR("sine"); DESCR("sine");
DATA(insert OID = 1605 ( cos PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dcos - )); DATA(insert OID = 1605 ( cos PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dcos - ));
DESCR("cosine"); DESCR("cosine");
DATA(insert OID = 1606 ( tan PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dtan - )); DATA(insert OID = 1606 ( tan PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dtan - ));
DESCR("tangent"); DESCR("tangent");
DATA(insert OID = 1607 ( cot PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 dcot - )); DATA(insert OID = 1607 ( cot PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 dcot - ));
DESCR("cotangent"); DESCR("cotangent");
DATA(insert OID = 1608 ( degrees PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 degrees - )); DATA(insert OID = 1608 ( degrees PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 degrees - ));
DESCR("radians to degrees");
DATA(insert OID = 1609 ( radians PGUID 11 f t t t 1 f 701 "701" 100 0 0 100 radians - ));
DESCR("radians to degrees"); DESCR("radians to degrees");
DATA(insert OID = 1610 ( pi PGUID 11 f t t t 0 f 701 "0" 100 0 0 100 dpi - )); DATA(insert OID = 1609 ( radians PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 radians - ));
DESCR("degrees to radians");
DATA(insert OID = 1610 ( pi PGUID 12 f t t t 0 f 701 "0" 100 0 0 100 dpi - ));
DESCR("PI"); DESCR("PI");
DATA(insert OID = 1618 ( interval_mul PGUID 12 f t t t 2 f 1186 "1186 701" 100 0 0 100 interval_mul - )); DATA(insert OID = 1618 ( interval_mul PGUID 12 f t t t 2 f 1186 "1186 701" 100 0 0 100 interval_mul - ));
...@@ -2295,7 +2295,7 @@ DESCR("lower-than"); ...@@ -2295,7 +2295,7 @@ DESCR("lower-than");
DATA(insert OID = 1723 ( numeric_le PGUID 12 f t t t 2 f 16 "1700 1700" 100 0 0 100 numeric_le - )); DATA(insert OID = 1723 ( numeric_le PGUID 12 f t t t 2 f 16 "1700 1700" 100 0 0 100 numeric_le - ));
DESCR("lower-than-or-equal"); DESCR("lower-than-or-equal");
DATA(insert OID = 1724 ( numeric_add PGUID 12 f t t t 2 f 1700 "1700 1700" 100 0 0 100 numeric_add - )); DATA(insert OID = 1724 ( numeric_add PGUID 12 f t t t 2 f 1700 "1700 1700" 100 0 0 100 numeric_add - ));
DESCR("addition"); DESCR("add");
DATA(insert OID = 1725 ( numeric_sub PGUID 12 f t t t 2 f 1700 "1700 1700" 100 0 0 100 numeric_sub - )); DATA(insert OID = 1725 ( numeric_sub PGUID 12 f t t t 2 f 1700 "1700 1700" 100 0 0 100 numeric_sub - ));
DESCR("subtract"); DESCR("subtract");
DATA(insert OID = 1726 ( numeric_mul PGUID 12 f t t t 2 f 1700 "1700 1700" 100 0 0 100 numeric_mul - )); DATA(insert OID = 1726 ( numeric_mul PGUID 12 f t t t 2 f 1700 "1700 1700" 100 0 0 100 numeric_mul - ));
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: builtins.h,v 1.127 2000/07/30 22:14:04 tgl Exp $ * $Id: builtins.h,v 1.128 2000/08/01 18:29:31 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -141,19 +141,9 @@ extern int namestrcpy(Name name, const char *str); ...@@ -141,19 +141,9 @@ extern int namestrcpy(Name name, const char *str);
extern int namestrcmp(Name name, const char *str); extern int namestrcmp(Name name, const char *str);
/* numutils.c */ /* numutils.c */
/* XXX hack. HP-UX has a ltoa (with different arguments) already. */
#ifdef __hpux
#define ltoa pg_ltoa
#endif /* hpux */
extern int32 pg_atoi(char *s, int size, int c); extern int32 pg_atoi(char *s, int size, int c);
extern void pg_itoa(int16 i, char *a);
/* XXX hack. QNX has itoa and ltoa (with different arguments) already. */ extern void pg_ltoa(int32 l, char *a);
#ifdef __QNX__
#define itoa pg_itoa
#define ltoa pg_ltoa
#endif /* QNX */
extern void itoa(int i, char *a);
extern void ltoa(int32 l, char *a);
/* /*
* Per-opclass comparison functions for new btrees. These are * Per-opclass comparison functions for new btrees. These are
...@@ -172,105 +162,99 @@ extern Datum btcharcmp(PG_FUNCTION_ARGS); ...@@ -172,105 +162,99 @@ extern Datum btcharcmp(PG_FUNCTION_ARGS);
extern Datum btnamecmp(PG_FUNCTION_ARGS); extern Datum btnamecmp(PG_FUNCTION_ARGS);
extern Datum bttextcmp(PG_FUNCTION_ARGS); extern Datum bttextcmp(PG_FUNCTION_ARGS);
/* filename.c */
extern char *filename_in(char *file);
extern char *filename_out(char *s);
/* float.c */ /* float.c */
extern float32 float4in(char *num); extern Datum float4in(PG_FUNCTION_ARGS);
extern char *float4out(float32 num); extern Datum float4out(PG_FUNCTION_ARGS);
extern float64 float8in(char *num); extern Datum float8in(PG_FUNCTION_ARGS);
extern char *float8out(float64 num); extern Datum float8out(PG_FUNCTION_ARGS);
extern float32 float4abs(float32 arg1); extern Datum float4abs(PG_FUNCTION_ARGS);
extern float32 float4um(float32 arg1); extern Datum float4um(PG_FUNCTION_ARGS);
extern float32 float4larger(float32 arg1, float32 arg2); extern Datum float4larger(PG_FUNCTION_ARGS);
extern float32 float4smaller(float32 arg1, float32 arg2); extern Datum float4smaller(PG_FUNCTION_ARGS);
extern float64 float8abs(float64 arg1); extern Datum float8abs(PG_FUNCTION_ARGS);
extern float64 float8um(float64 arg1); extern Datum float8um(PG_FUNCTION_ARGS);
extern float64 float8larger(float64 arg1, float64 arg2); extern Datum float8larger(PG_FUNCTION_ARGS);
extern float64 float8smaller(float64 arg1, float64 arg2); extern Datum float8smaller(PG_FUNCTION_ARGS);
extern float32 float4pl(float32 arg1, float32 arg2); extern Datum float4pl(PG_FUNCTION_ARGS);
extern float32 float4mi(float32 arg1, float32 arg2); extern Datum float4mi(PG_FUNCTION_ARGS);
extern float32 float4mul(float32 arg1, float32 arg2); extern Datum float4mul(PG_FUNCTION_ARGS);
extern float32 float4div(float32 arg1, float32 arg2); extern Datum float4div(PG_FUNCTION_ARGS);
extern float64 float8pl(float64 arg1, float64 arg2); extern Datum float8pl(PG_FUNCTION_ARGS);
extern float64 float8mi(float64 arg1, float64 arg2); extern Datum float8mi(PG_FUNCTION_ARGS);
extern float64 float8mul(float64 arg1, float64 arg2); extern Datum float8mul(PG_FUNCTION_ARGS);
extern float64 float8div(float64 arg1, float64 arg2); extern Datum float8div(PG_FUNCTION_ARGS);
extern bool float4eq(float32 arg1, float32 arg2); extern Datum float4eq(PG_FUNCTION_ARGS);
extern bool float4ne(float32 arg1, float32 arg2); extern Datum float4ne(PG_FUNCTION_ARGS);
extern bool float4lt(float32 arg1, float32 arg2); extern Datum float4lt(PG_FUNCTION_ARGS);
extern bool float4le(float32 arg1, float32 arg2); extern Datum float4le(PG_FUNCTION_ARGS);
extern bool float4gt(float32 arg1, float32 arg2); extern Datum float4gt(PG_FUNCTION_ARGS);
extern bool float4ge(float32 arg1, float32 arg2); extern Datum float4ge(PG_FUNCTION_ARGS);
extern bool float8eq(float64 arg1, float64 arg2); extern Datum float8eq(PG_FUNCTION_ARGS);
extern bool float8ne(float64 arg1, float64 arg2); extern Datum float8ne(PG_FUNCTION_ARGS);
extern bool float8lt(float64 arg1, float64 arg2); extern Datum float8lt(PG_FUNCTION_ARGS);
extern bool float8le(float64 arg1, float64 arg2); extern Datum float8le(PG_FUNCTION_ARGS);
extern bool float8gt(float64 arg1, float64 arg2); extern Datum float8gt(PG_FUNCTION_ARGS);
extern bool float8ge(float64 arg1, float64 arg2); extern Datum float8ge(PG_FUNCTION_ARGS);
extern float64 ftod(float32 num); extern Datum ftod(PG_FUNCTION_ARGS);
extern Datum i4tod(PG_FUNCTION_ARGS); extern Datum i4tod(PG_FUNCTION_ARGS);
extern Datum i2tod(PG_FUNCTION_ARGS); extern Datum i2tod(PG_FUNCTION_ARGS);
extern float32 dtof(float64 num); extern Datum dtof(PG_FUNCTION_ARGS);
extern int32 dtoi4(float64 num); extern Datum dtoi4(PG_FUNCTION_ARGS);
extern Datum dtoi2(PG_FUNCTION_ARGS); extern Datum dtoi2(PG_FUNCTION_ARGS);
extern Datum i4tof(PG_FUNCTION_ARGS); extern Datum i4tof(PG_FUNCTION_ARGS);
extern Datum i2tof(PG_FUNCTION_ARGS); extern Datum i2tof(PG_FUNCTION_ARGS);
extern int32 ftoi4(float32 num); extern Datum ftoi4(PG_FUNCTION_ARGS);
extern Datum ftoi2(PG_FUNCTION_ARGS); extern Datum ftoi2(PG_FUNCTION_ARGS);
extern Datum text_float8(PG_FUNCTION_ARGS); extern Datum text_float8(PG_FUNCTION_ARGS);
extern Datum text_float4(PG_FUNCTION_ARGS); extern Datum text_float4(PG_FUNCTION_ARGS);
extern Datum float8_text(PG_FUNCTION_ARGS); extern Datum float8_text(PG_FUNCTION_ARGS);
extern Datum float4_text(PG_FUNCTION_ARGS); extern Datum float4_text(PG_FUNCTION_ARGS);
extern float64 dround(float64 arg1); extern Datum dround(PG_FUNCTION_ARGS);
extern float64 dtrunc(float64 arg1); extern Datum dtrunc(PG_FUNCTION_ARGS);
extern float64 dsqrt(float64 arg1); extern Datum dsqrt(PG_FUNCTION_ARGS);
extern float64 dcbrt(float64 arg1); extern Datum dcbrt(PG_FUNCTION_ARGS);
extern float64 dpow(float64 arg1, float64 arg2); extern Datum dpow(PG_FUNCTION_ARGS);
extern float64 dexp(float64 arg1); extern Datum dexp(PG_FUNCTION_ARGS);
extern float64 dlog1(float64 arg1); extern Datum dlog1(PG_FUNCTION_ARGS);
extern float64 dlog10(float64 arg1); extern Datum dlog10(PG_FUNCTION_ARGS);
extern float64 dacos(float64 arg1); extern Datum dacos(PG_FUNCTION_ARGS);
extern float64 dasin(float64 arg1); extern Datum dasin(PG_FUNCTION_ARGS);
extern float64 datan(float64 arg1); extern Datum datan(PG_FUNCTION_ARGS);
extern float64 datan2(float64 arg1, float64 arg2); extern Datum datan2(PG_FUNCTION_ARGS);
extern float64 dcos(float64 arg1); extern Datum dcos(PG_FUNCTION_ARGS);
extern float64 dcot(float64 arg1); extern Datum dcot(PG_FUNCTION_ARGS);
extern float64 dsin(float64 arg1); extern Datum dsin(PG_FUNCTION_ARGS);
extern float64 dtan(float64 arg1); extern Datum dtan(PG_FUNCTION_ARGS);
extern float64 degrees(float64 arg1); extern Datum degrees(PG_FUNCTION_ARGS);
extern float64 dpi(void); extern Datum dpi(PG_FUNCTION_ARGS);
extern float64 radians(float64 arg1); extern Datum radians(PG_FUNCTION_ARGS);
extern float64 dtan(float64 arg1); extern Datum drandom(PG_FUNCTION_ARGS);
extern float64 drandom(void); extern Datum setseed(PG_FUNCTION_ARGS);
extern int32 setseed(float64 seed);
extern Datum float8_accum(PG_FUNCTION_ARGS); extern Datum float8_accum(PG_FUNCTION_ARGS);
extern Datum float4_accum(PG_FUNCTION_ARGS); extern Datum float4_accum(PG_FUNCTION_ARGS);
extern Datum float8_avg(PG_FUNCTION_ARGS); extern Datum float8_avg(PG_FUNCTION_ARGS);
extern Datum float8_variance(PG_FUNCTION_ARGS); extern Datum float8_variance(PG_FUNCTION_ARGS);
extern Datum float8_stddev(PG_FUNCTION_ARGS); extern Datum float8_stddev(PG_FUNCTION_ARGS);
extern Datum float48pl(PG_FUNCTION_ARGS);
extern float64 float48pl(float32 arg1, float64 arg2); extern Datum float48mi(PG_FUNCTION_ARGS);
extern float64 float48mi(float32 arg1, float64 arg2); extern Datum float48mul(PG_FUNCTION_ARGS);
extern float64 float48mul(float32 arg1, float64 arg2); extern Datum float48div(PG_FUNCTION_ARGS);
extern float64 float48div(float32 arg1, float64 arg2); extern Datum float84pl(PG_FUNCTION_ARGS);
extern float64 float84pl(float64 arg1, float32 arg2); extern Datum float84mi(PG_FUNCTION_ARGS);
extern float64 float84mi(float64 arg1, float32 arg2); extern Datum float84mul(PG_FUNCTION_ARGS);
extern float64 float84mul(float64 arg1, float32 arg2); extern Datum float84div(PG_FUNCTION_ARGS);
extern float64 float84div(float64 arg1, float32 arg2); extern Datum float48eq(PG_FUNCTION_ARGS);
extern bool float48eq(float32 arg1, float64 arg2); extern Datum float48ne(PG_FUNCTION_ARGS);
extern bool float48ne(float32 arg1, float64 arg2); extern Datum float48lt(PG_FUNCTION_ARGS);
extern bool float48lt(float32 arg1, float64 arg2); extern Datum float48le(PG_FUNCTION_ARGS);
extern bool float48le(float32 arg1, float64 arg2); extern Datum float48gt(PG_FUNCTION_ARGS);
extern bool float48gt(float32 arg1, float64 arg2); extern Datum float48ge(PG_FUNCTION_ARGS);
extern bool float48ge(float32 arg1, float64 arg2); extern Datum float84eq(PG_FUNCTION_ARGS);
extern bool float84eq(float64 arg1, float32 arg2); extern Datum float84ne(PG_FUNCTION_ARGS);
extern bool float84ne(float64 arg1, float32 arg2); extern Datum float84lt(PG_FUNCTION_ARGS);
extern bool float84lt(float64 arg1, float32 arg2); extern Datum float84le(PG_FUNCTION_ARGS);
extern bool float84le(float64 arg1, float32 arg2); extern Datum float84gt(PG_FUNCTION_ARGS);
extern bool float84gt(float64 arg1, float32 arg2); extern Datum float84ge(PG_FUNCTION_ARGS);
extern bool float84ge(float64 arg1, float32 arg2);
/* misc.c */ /* misc.c */
extern Datum nullvalue(PG_FUNCTION_ARGS); extern Datum nullvalue(PG_FUNCTION_ARGS);
......
...@@ -25,13 +25,13 @@ extern bool cash_ge(Cash *c1, Cash *c2); ...@@ -25,13 +25,13 @@ extern bool cash_ge(Cash *c1, Cash *c2);
extern Cash *cash_pl(Cash *c1, Cash *c2); extern Cash *cash_pl(Cash *c1, Cash *c2);
extern Cash *cash_mi(Cash *c1, Cash *c2); extern Cash *cash_mi(Cash *c1, Cash *c2);
extern Cash *cash_mul_flt8(Cash *c, float8 *f); extern Datum cash_mul_flt8(PG_FUNCTION_ARGS);
extern Cash *cash_div_flt8(Cash *c, float8 *f); extern Datum cash_div_flt8(PG_FUNCTION_ARGS);
extern Cash *flt8_mul_cash(float8 *f, Cash *c); extern Datum flt8_mul_cash(PG_FUNCTION_ARGS);
extern Cash *cash_mul_flt4(Cash *c, float4 *f); extern Datum cash_mul_flt4(PG_FUNCTION_ARGS);
extern Cash *cash_div_flt4(Cash *c, float4 *f); extern Datum cash_div_flt4(PG_FUNCTION_ARGS);
extern Cash *flt4_mul_cash(float4 *f, Cash *c); extern Datum flt4_mul_cash(PG_FUNCTION_ARGS);
extern Datum cash_mul_int4(PG_FUNCTION_ARGS); extern Datum cash_mul_int4(PG_FUNCTION_ARGS);
extern Datum cash_div_int4(PG_FUNCTION_ARGS); extern Datum cash_div_int4(PG_FUNCTION_ARGS);
......
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