38 if (sscanf(
str,
" ( %lf , %lf )", &
x, &
y) != 2)
40 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
41 errmsg(
"invalid input syntax for type %s: \"%s\"",
58 result =
psprintf(
"(%g,%g)", complex->
x, complex->
y);
112 result->
x =
a->x +
b->x;
113 result->
y =
a->y +
b->y;
129 #define Mag(c) ((c)->x*(c)->x + (c)->y*(c)->y)
134 double amag =
Mag(
a),
Datum complex_in(PG_FUNCTION_ARGS)
Datum complex_abs_cmp(PG_FUNCTION_ARGS)
static int complex_abs_cmp_internal(Complex *a, Complex *b)
Datum complex_add(PG_FUNCTION_ARGS)
Datum complex_send(PG_FUNCTION_ARGS)
Datum complex_recv(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(complex_in)
Datum complex_abs_ge(PG_FUNCTION_ARGS)
Datum complex_abs_gt(PG_FUNCTION_ARGS)
Datum complex_abs_lt(PG_FUNCTION_ARGS)
Datum complex_abs_le(PG_FUNCTION_ARGS)
Datum complex_abs_eq(PG_FUNCTION_ARGS)
Datum complex_out(PG_FUNCTION_ARGS)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_RETURN_BYTEA_P(x)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_CSTRING(x)
#define PG_GETARG_CSTRING(n)
#define PG_RETURN_INT32(x)
#define PG_RETURN_POINTER(x)
#define PG_RETURN_BOOL(x)
char * psprintf(const char *fmt,...)
StringInfoData * StringInfo