16 questions with no answers
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
...
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):...
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 ...
1
vote
0
answers
446
views
Undefined function bandwidthThrottle\tokenBucket\util\bcsub() When bcsub installed on all php versions on the server
I've got a project on an Ubutu server. I keep getting the following error
\FatalThrowableError: Call to undefined function bandwidthThrottle\tokenBucket\util\bcsub()
in vendor/bandwidth-throttle/...
2
votes
0
answers
2k
views
Enable bcmath module PHP 7.2 server CLI
I have installed the php bcmath module for 7.2 via the command:
yum install php-bcmath
I can see that it's there, but it's not in the php ini file when I check with command php -i
How can I enable ...
1
vote
0
answers
3k
views
I installed bcmath, but I can't get my laravel project find it
I am working on a Laravel project using the auth scaffolding. When trying the link "forgot your password" with a valid mail address, I get the following error:
The BCMath functions must be enabled to ...
0
votes
0
answers
498
views
PHP: Install bcmath mdoule to specific version of php
I have 2 versions of php5.6 installed in my Ubuntu16.0.4. One is ZTS(Zend Thread Safety) enabled and another does not have zts. I want to install bcmath module to php-zts version. I used "apt install ...
0
votes
0
answers
627
views
bcadd function not adding correctly
I have a problem in my php code where it didn't sum two floating point numbers. For this below code snippet it shows the output of "0.00108225".
print_r(bcadd(0.00108225, 0.00008892,8));
It shows ...
0
votes
0
answers
89
views
php bcpowmod returns floating point
When using bcpowmod, I sometimes get back a string with a floating point value in it. It only does this sometimes when running the function through WAMP server. Other times, it works as expected, ...
0
votes
0
answers
72
views
bcmath calculation doesn't give precise answer
Take a look at this example in regular math:
<?php
$rate = 788.159;
$amount = 1182.2385;
var_dump($amount*(1/$rate));
and the answer is as expected:
float(1.5)
however when same is done ...
0
votes
0
answers
395
views
Using the bcmath functions correctly
I've never used the bcmath figures before and having been doing a bit of reading about comparing and manipulating floating point numbers and this has led me to the bcmath functions.
I understand you ...
0
votes
0
answers
132
views
MySQL, using decimal type, still getting imprecise output when using math functions
Have a PHP script - using all the correct bcmath functions, and fully understand the issues with floats. I'm also using decimal columns, because, I was under the impression, those are stored as a ...
1
vote
0
answers
165
views
How to add a library to PHP?
My version of PHP, 5.3.8, doesn't contain BC-Math, which is needed for many cryptocurrency functions.
Google hasn't been particularly helpful for links on how to install this particularly library, so ...