Added cast from half to numeric [skip ci]

This commit is contained in:
Andrew Kane
2023-12-04 12:38:34 -08:00
parent 4b630d4f27
commit 95eff595f0
5 changed files with 53 additions and 5 deletions

View File

@@ -426,6 +426,20 @@ numeric_to_half(PG_FUNCTION_ARGS)
PG_RETURN_HALF(h);
}
/*
* Convert half to numeric
*/
PGDLLEXPORT PG_FUNCTION_INFO_V1(half_to_numeric);
Datum
half_to_numeric(PG_FUNCTION_ARGS)
{
half h = PG_GETARG_HALF(0);
float f = HalfToFloat4(h);
Numeric num = DatumGetNumeric(DirectFunctionCall1(float4_numeric, Float4GetDatum(f)));
PG_RETURN_NUMERIC(num);
}
/*
* Convert float4 to half
*/