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

bcsub produces erroneous result. #32

Closed
YOMorales opened this issue Apr 18, 2012 · 2 comments
Closed

bcsub produces erroneous result. #32

YOMorales opened this issue Apr 18, 2012 · 2 comments

Comments

@YOMorales
Copy link

In PHP, the following code results in 0.018, which is correct:

$bcResult = bcsub(0.03, bcmul(0.03, 0.40, 3), 3);
var_dump($bcResult);

However, in PHPJS, that same code returns 0.001, which is incorrect:
var bcResult = bcsub(0.03, bcmul(0.03, 0.40, 3), 3);
console.debug(bcResult);

I have tested and bcmul for PHPJS works fine (i.e. the above bcmul(0.03, 0.40, 3) is correct). The problem is when doing the bcsub.

@kvz
Copy link
Collaborator

kvz commented Mar 4, 2014

This is all in shared_bc.js which might be in need of an update. If you want to contribute please add a failing testcase ton the header of bcsub and run

node bin/phpjs.js --action test --name bcsub

Until it works. Thanks in advance for your help!

@kvz
Copy link
Collaborator

kvz commented May 21, 2016

Thanks for reporting, and sorry for the long wait. This project and my motivation were in a bad spot. I recently did a lot of work to breathe new life into it (http://locutus.io/2016/05/announcing-locutus/). As part of this I'm going over all issues and PRs now. It seems this issue was resolved in the big push, so I'm closing this : )

@kvz kvz closed this as completed May 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants