On 2024-03-26 11:35, Saki Takamachi wrote:
**I immediately reflected the above two points in my RFC** :D
Thanks, looks good.
One more suggestion - might it be worth adding a `format` function
to the new BcNum class? This would be similar to the existing
number_format function, but would avoid the need to lose precision by
converting to float first.
I came up with the following code, is it close to what you intended?
```
$num = BcNum::fromNumberFormat(1.2345, 5);
$num->value; // 1.23450
```
No, that's not quite what I meant - I meant more like the opposite:
```
$bcNum = new BcNum('1234567890123456789.23456789');
echo $bcNum->format(8, '.', ',') // 1,234,567,890,123,456,789.23456789
```
Maybe also worth providing a way to specify that all decimals should be
printed, instead of just a fixed number of decimals.