darcy@druid.net (D'Arcy J.M. Cain) writes:
>> ! *result = floor((*f) * (*c) + 0.5);
> Is this correct? What about "select cash_mul_flt8('$1', '123.99')?"
> Wouldn't that convert it to 124.00?
No, because the cash type is actually "int". Presumably it's scaled
up by a factor of 100 compared to what's printed --- otherwise you'd
never be able to represent pennies at all. So the "round to nearest
integer" logic depicted above is really rounding to nearest penny.
regards, tom lane