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

Function numeric_float8

src/backend/utils/adt/numeric.c:4425–4450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4423
4424
4425Datum
4426numeric_float8(PG_FUNCTION_ARGS)
4427{
4428 Numeric num = PG_GETARG_NUMERIC(0);
4429 char *tmp;
4430 Datum result;
4431
4432 if (NUMERIC_IS_SPECIAL(num))
4433 {
4434 if (NUMERIC_IS_PINF(num))
4435 PG_RETURN_FLOAT8(get_float8_infinity());
4436 else if (NUMERIC_IS_NINF(num))
4437 PG_RETURN_FLOAT8(-get_float8_infinity());
4438 else
4439 PG_RETURN_FLOAT8(get_float8_nan());
4440 }
4441
4442 tmp = DatumGetCString(DirectFunctionCall1(numeric_out,
4443 NumericGetDatum(num)));
4444
4445 result = DirectFunctionCall1(float8in, CStringGetDatum(tmp));
4446
4447 pfree(tmp);
4448
4449 PG_RETURN_DATUM(result);
4450}
4451
4452/*
4453 * GPDB: wrap of new api numericvar_to_double_no_overflow.

Callers

nothing calls this directly

Calls 5

DatumGetCStringFunction · 0.85
CStringGetDatumFunction · 0.85
get_float8_infinityFunction · 0.50
get_float8_nanFunction · 0.50
pfreeFunction · 0.50

Tested by

no test coverage detected