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

ceil() doesn't appear work for very small numbers #25

Open
gahorth opened this issue Feb 3, 2024 · 0 comments
Open

ceil() doesn't appear work for very small numbers #25

gahorth opened this issue Feb 3, 2024 · 0 comments

Comments

@gahorth
Copy link

gahorth commented Feb 3, 2024

Using ceil() on a number such as "0.09" returns zero, but should return 1. PHP's ceil() function returns 1 for a float value of 0.09.

eg.

$num = Decimal::create(0.09000,5)->ceil();  //$num = 0 (should be 1)
$num = Decimal::create(0.00001,5)->ceil();  //$num = 0 (should be 1)
$num = Decimal::create(1.00001,5)->ceil();  //$num = 1 (should be 2)
$num = ceil(0.09);  //$num = 1 (correct)
$num = ceil(0.00001);  //$num = 1 (correct)
$num = ceil(1.00001);  //$num = 2 (correct)

Is this a bug or am I doing something wrong?

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

No branches or pull requests

1 participant