php - bcadd has different point precision -


on windows box when run

  $sr = "0";   $spr = "149";   $sr = bcadd($sr, $spr);   echo "$sr";  

it outputs 149.0000000000

but when upload same code linux host, output 149.

why?

probably "scale" different on 2 environments.

try set scale bcscale function before doing operations, example:

bcscale(3);  $sr = "0"; $spr = "149"; $sr = bcadd($sr, $spr); echo "$sr";  

or use third parameter in bcadd set scale:

$sr = "0"; $spr = "149"; $sr = bcadd($sr, $spr, 3); echo "$sr";  

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -