# Allow int arguments for BCMath functions

- Thread: https://externals.io/message/123924
- Original archive: https://news-web.php.net/php.internals/123924
- Started by Saki Takamachi on 2024-06-27T05:23:20+00:00
- Messages: 1
- RFC: Allow int type argument to BCMath function (Inactive) — https://externals.io/rfc/allow_int_args_to_bcmath_function.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #123924 — Saki Takamachi — 2024-06-27T05:23:20+00:00

URL: https://externals.io/message/123924#123924

Hi all!

Gina suggest out that accept the BCMath\Number class as an argument to existing functions.

This is difficult due to issues with dealing with scale, but I found that an int could be accepted.

Without strict typing, if you pass an int to an existing bc function, it will be converted to a string and then to a bc_num struct, which is obviously inefficient.

Conversion from string to bc_num is a big cost that cannot be ignored. And I'm planning on modifying the structure to make it even faster. I'm not sure if it will be ready in time for 8.4, but it will definitely have synergies with the conversion from int.

FYI, the return type is always a string, even if you pass two ints to bcadd. The return type does not change.

Regards,

Saki
