Re: BCMath: Supporting scientific notation

From: Date: Sat, 15 Mar 2025 11:40:04 +0000
Subject: Re: BCMath: Supporting scientific notation
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 15.03.2025 at 01:14, Saki Takamachi wrote:

> In the following issue, there was a proposal to add support for scientific notation in BCMath.
> https://github.com/php/php-src/issues/17876
>
> I agree with this and have already created a prototype.
> https://github.com/php/php-src/pull/18068
>
> The prototype allows to pass scientific notation values ​​to both functions and classes in
> the same way as normal numeric string.
>
> The Number class could add a method to convert strings to scientific notation, or it could
> simply not accept scientific notation in the constructor and create a dedicated static method for
> it.
> We can also choose not to accept scientific notation in BCMath functions..
>
> Could you please give your opinion on this?

The only problem I see with this is that users might now cast (almost)
arbitrary float values to string, and pass these to BCMath.  However,
they can already do that for many float values, so probably not a big
problem.

Christoph


Thread (2 messages)

« previous php.internals (#126778) next »