Re: [RFC] [Discussion] Support object type in BCMath
| From: | Saki Takamachi | Date: | Tue, 26 Mar 2024 12:50:48 +0000 |
| Subject: | Re: [RFC] [Discussion] Support object type in BCMath | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-122748@lists.php.net to get a copy of this message | ||
Hi Barney,
> 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.
Ah I see! It sounds exactly like
number_format. Sure, this might make sense. To me,
this seems worth supporting.
BTW,
```
$bcNum = new BcNum('1234567890123456789.23456789’);
```
When I saw this, I thought that the behavior when $scale is omitted is that in addition to the
option of "using the global setting value", there is also the option of "counting the
length of $num and storing all $num”. In other words, it does not use
any global settings.
Which of these do you think is better?
Regards.
Saki