On 27.03.2024 01:03, Saki Takamachi wrote:
$num = new BcNum('1.23', 2); $result = $num + '1.23456'; $result->value; // '2.46456' $result->scale; // ??In this case, `$result->scale` will be `'5'`. I added this to the RFC.
I'm not sure I like this. Maybe we should be more strict here and treat the $scale in constructor (and later withScale()) as the actual scale for all operations.
So, in the case above I'd expect ->scale to be 2, and ->value to be '2.46'. If I wanted $num to have a scale that may change, I'd not define it in the first place. Does that make sense?
ps. that also means withScale(null) should be possible. -- Aleksander Machniak Kolab Groupware Developer [https://kolab.org] Roundcube Webmail Developer [https://roundcube.net] ---------------------------------------------------- PGP: 19359DC1 # Blog: https://kolabian.wordpress.com
