On 8-7-2024 5:18, Saki Takamachi wrote:
Hi Juliette,
Hi Saki,
Just wondering: why `int|string` instead of `float|string` ?
In my experience, floats are the more pertinent type for which to use the
BCMath extension.
Smile,
Juliette
Since floating point numbers always contain a certain amount of error, I
believe that they are not suitable as arguments for BCMath.
Okay, so in that case, I must be missing something.
For example, 0.285 becomes 0.284999... in floating point. From the perspective
of arbitrary precision math, there is no universally agreeable way to properly
handle values like this: there will always be people who want to treat it as
0.285, and people who want to treat it as 0.284999....
I honestly don't understand what you are saying here.
If 0.285 is a string, then no type conversion would be needed to pass it
to BCMath anyhow.
Otherwise, 0.285 would be a floating point number already.
If the type for BCMath would become `int|string`, in non-strict mode,
there would be quite a significant change in behaviour for the BCMath
functions as passing the _float_ 0.285 would previously result in the
string "0.285" being passed to the BCMath function, but would now result
in the integer 0 being passed.
I think this BC-break will need to be called out as it is not mentioned
in the RFC.
I also think this BC-break should be enough reason not to accept the RFC.
Smile,
Juliette