Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bcmath functions to support scientific notation numbers #17876

Open
edoniti opened this issue Feb 21, 2025 · 2 comments
Open

bcmath functions to support scientific notation numbers #17876

edoniti opened this issue Feb 21, 2025 · 2 comments

Comments

@edoniti
Copy link

edoniti commented Feb 21, 2025

Description

I occurred a problem with bcmath functions, bcadd, bcround specifically, where they do not support scientific notation numbers, for example 2.3314683517128E-14.

A solution that I found online was to use as bcround(sprintf("%.20f", (float)$rest['nett']), 9), but it is a bit hard to do that everywhere.

Wouldn't it be more logical for bc* functions to support 2.3314683517128E-14 since they support 0.0000000000000023314683517128 for example

@gzhegow1991
Copy link

Isn't it possible to create your own number using bcpow('number', 'pow_value') instead of sprintf converting from float?

@SakiTakamachi
Copy link
Member

I think this is a sensible idea.

However, I am currently testing whether this can actually be achieved without sacrificing performance.

Either way, this should be discussed on the internal mailing list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants