Re: [RFC] [Discussion] Adding bcround, bcfloor and bcceil to BCMath
| From: | Pierre Joye | Date: | Tue, 03 Oct 2023 07:41:01 +0000 |
| Subject: | Re: [RFC] [Discussion] Adding bcround, bcfloor and bcceil to BCMath | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121212@lists.php.net to get a copy of this message | ||
On Tue, Oct 3, 2023, 12:25 PM Saki Takamachi <saki@sakiot.com> wrote:
>
> I thought GMP was a function for integers, so I wasn't expecting that tbh.
>
> However, even if GMP supported floating point numbers, wouldn't it end up
> having the inherent error problem of floating point numbers?
>
yes, they do, as do almost all floating points implementation.
Memory limited float values and their respective operations are still
useful in many areas, but financial values and the likes. Scaled integers
are the way for accuracy.
Also, side note, gmp recommends to rely on https://www.mpfr.org/
for
accurate FP operations
best,
>