Hi, > What I'm saying is that $x / 2 doesn't have a good answer if $x is a > fixed-precision number which can't be divided by 2 without exceeding that > precision. You need a third operand, the rounding mode, so you can't write it > as a binary operator, and need some kind of function like decimal_div(decimal > $dividend, int|decimal $divisor, RoundingMode $roundingMode). How you > implement "decimal" doesn't change that at all. >
IMHO, if need a parameter that is anything other than a pure value, it's a bad fit for a native type. It's just a different notation for creating instances. If we really wanted decimal to be a native type, then the rounding mode and scale behavior should be completely fixed and not user selectable. If not, decimal should be implemented as a class. In fact, php's float will round values that are too fine, and cannot specify how it will round them. (This involves CPU floating point modes, but I wanted to keep it consistent so I just gave it as an example.) Regards. Saki