MCPcopy Create free account
hub / github.com/apache/cloudberry / numeric2complex

Function numeric2complex

src/backend/utils/adt/complex_type.c:1298–1314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1296}
1297
1298Datum
1299numeric2complex(PG_FUNCTION_ARGS)
1300{
1301 Numeric num = PG_GETARG_NUMERIC(0);
1302 double float_num;
1303
1304 if (NUMERIC_IS_NAN(num))
1305 {
1306 float_num = get_float8_nan();
1307 }
1308 else
1309 {
1310 float_num = DatumGetFloat8(DirectFunctionCall1(numeric_float8, NumericGetDatum(num)));
1311 }
1312
1313 PG_RETURN_COMPLEX_P(construct_complex_in(float_num, 0));
1314}
1315
1316/*
1317 * complex_dot_product - returns dot product of two 1-dim array with the same size

Callers

nothing calls this directly

Calls 3

DatumGetFloat8Function · 0.85
construct_complex_inFunction · 0.85
get_float8_nanFunction · 0.50

Tested by

no test coverage detected