- V effectively
+ V with to_char
multiplies the input values by
10^n, where
n is the number of digits following
- V.
- to_char does not support the use of
+ V. V with
+ to_number divides in a similar manner.
+ to_char and to_number
+ do not support the use of
V combined with a decimal point
(e.g., 99.9V99 is not allowed).
VARSIZE(value) - VARHDRSZ, 0, 0, false, PG_GET_COLLATION());
scale = Num.post;
- precision = Max(0, Num.pre) + scale;
+ precision = Num.pre + Num.multi + scale;
if (shouldFree)
pfree(format);
CStringGetDatum(numstr),
ObjectIdGetDatum(InvalidOid),
Int32GetDatum(((precision << 16) | scale) + VARHDRSZ));
+
+ if (IS_MULTI(&Num))
+ {
+ Numeric x;
+ Numeric a = DatumGetNumeric(DirectFunctionCall1(int4_numeric,
+ Int32GetDatum(10)));
+ Numeric b = DatumGetNumeric(DirectFunctionCall1(int4_numeric,
+ Int32GetDatum(-Num.multi)));
+
+ x = DatumGetNumeric(DirectFunctionCall2(numeric_power,
+ NumericGetDatum(a),
+ NumericGetDatum(b)));
+ result = DirectFunctionCall2(numeric_mul,
+ result,
+ NumericGetDatum(x));
+ }
+
pfree(numstr);
return result;
}