MCPcopy Create free account
hub / github.com/apache/madlib / average_root_finalize

Function average_root_finalize

methods/array_ops/src/pg_gp/array_ops.c:1130–1142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1128}
1129
1130static
1131inline
1132Datum
1133average_root_finalize(Datum elt,int size,Oid element_type){
1134 float8 value = datum_float8_cast(elt, element_type);
1135 if (size == 0) {
1136 return Float8GetDatum(0);
1137 } else if (size == 1) {
1138 return Float8GetDatum(0);
1139 } else {
1140 return Float8GetDatum(sqrt(value/((float8)size - 1)));
1141 }
1142}
1143
1144/* -----------------------------------------------------------------------
1145 * Type cast functions

Callers

nothing calls this directly

Calls 1

datum_float8_castFunction · 0.85

Tested by

no test coverage detected