Re: [RFC] [Discussion] Allow int type argument to BCMath function

From: Date: Mon, 08 Jul 2024 03:18:15 +0000
Subject: Re: [RFC] [Discussion] Allow int type argument to BCMath function
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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.

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....

Therefore, I believe BCMath should not accept floats as arguments.

Regards,

Saki


Thread (12 messages)

« previous php.internals (#124273) next »