105 questions
0
votes
0
answers
21
views
php8.3.29 Ubuntu 24.04 can't install bcmath
I don't understand the dependency problem. PHP8.3-common is installed but version 8.3.29
I can't understand why it seems to be asking for 8.3.6
root@choir:~# php -v
PHP 8.3.29 (cli) (built: Dec 18 ...
0
votes
1
answer
85
views
PHP's bcmul() wrong result
Why is this outputting 0.99 and not 1?
<?php
echo bcmul("2.54", "0.3937007874015748", 2); // 0.99
echo 2.54 * 0.3937007874015748; // 1
?>
My PHP Version 7.4.33
0
votes
1
answer
337
views
Getting Error when try to enable bcmath extension on heroku using composer.json file
I am trying to enable bcmath php extension on heroku using composer.json file as per documentation instructions article.
When try to build i got error
remote: Problem 1
remote: - Root composer....
1
vote
1
answer
3k
views
Can't install php 8.0 bcmath
I need to install the bcmath module because it is necessary for the wordpress ip2location plugin but I'm finding it impossible. I have followed other similar posts and nothing has worked. I am using ...
0
votes
0
answers
16
views
BCMath - imitate calculator or excel [duplicate]
I'm working with decimal values that can have more decimal digits than the float type, so I have to use bcmath functions.
My problem is that standard calculators like in Windows, Android or PHP ...
1
vote
0
answers
177
views
PHP bcmul() not using correct precision
I'm trying to use the PHP bcmath library to handle the problem of rounding errors in PHP.
My code:
$usdPerCoin = 2755905;
$amountToConvert = 1000;
function toFixed(string $number, int $precision = 8):...
2
votes
0
answers
521
views
Can't install php7.4-bcmath on Ubuntu 18
There is a server on Ubuntu 18. Worth nginx and php 7.4
I need to install php7.4-bcmath
Command: "sudo apt-get install php7.4-bcmath" keeps giving error:
Reading package lists... Done
...
0
votes
1
answer
101
views
Are PHP BC Math functions automatically converting integers and flaots to strings?
Are PHP BC Math functions automatically converting integers and flaots to strings?
The example below works fine on PHP 7.4 on windows, but some people claim that BC Math only accepts strings as input.
...
0
votes
1
answer
1k
views
bcmath extention is enabled in my ubuntu system for php 8.2, but drupal 10 commerce module it is showing error
$ php -i | grep -i bcmath
PHP Warning: Module "gd" is already loaded in Unknown on line 0
/etc/php/8.2/cli/conf.d/20-bcmath.ini,
bcmath
BCMath support => enabled
bcmath.scale => 1 =&...
0
votes
1
answer
135
views
count significant digits in PHP
i am writing a class that does simple bcmath operations on numbers.
tho i need to set the scale automatically throughout this so i need a way to determine how many significant digits a number has.
for ...
0
votes
0
answers
368
views
In PHP Is it better to leave the result of bcmath functions as strings or cast the result back to a float?
If I use a bcmath function, they all take values as strings and return a string. I have several functions that use bcmath in order to work on monetary values. The database stores these values as a ...
0
votes
0
answers
397
views
PHP Modules not matching with PHP Info file
So I am trying to install the bcmath module and it seems to have worked but when I check my phpinfo it says it is not on there.
This is the output I get when I do php -m
[PHP Modules]
bcmath
bz2
...
0
votes
0
answers
261
views
Twig fixed point arithmetic
I'm trying to do precise arithmetics calculations inside a Twig template, but I am struggling with floating point's precision error and I can't find a way to solve this.
Is there a way to solve this ...
0
votes
1
answer
183
views
Large number multiplication and division
I am trying the below mentioned code(PHP) to find probability. The calculation includes combination calculation of large numbers, using BCmaths function but not getting results. Please suggest, how ...
6
votes
2
answers
11k
views
PHP BCMath cannot handle the exponential number if it is passed to its function, PHP BCMath return " bcmath function argument is not well-formed"
I working on the few of the small decimals like 0.0000687, 0.0000063241, 0.0000454. I used BCMath as to get the most precise result because it involved with money calculation, so far BCMath it is very ...