Re: [RFC] [Discussion] Support object type in BCMath

From: Date: Tue, 02 Apr 2024 13:49:21 +0000
Subject: Re: [RFC] [Discussion] Support object type in BCMath
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-122858@lists.php.net to get a copy of this message
On 2024-04-02 12:26, Saki Takamachi wrote:
Also, an idea occurred to me while reading your comments. The current assumption is that a Number always holds a single value. How if we made it so that it held two values? They are the numerator and the denominator.
Then we'd have a rational number, instead of an arbitrary precision decimal. I think that's a sufficiently different data type that it should be a different class (if required), and probably a separate RFC, and for now it's better to stay closer to the existing BCMath API. Developers should be prepared to accept that an arbitrary precision decimal can't represent 1/3 exactly, just like a binary float can't represent 1/10 exactly.

« previous php.internals (#122858) next »