mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-04 11:40:57 +08:00
Added cast from half to numeric [skip ci]
This commit is contained in:
14
src/half.c
14
src/half.c
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user