[ProgClub programming] jsphp.co: new bcmod function

John Elliot jj5 at progclub.org
Sat Mar 17 13:30:37 EST 2012

I was working on some software and I found myself wanting a version of
the PHP bcmod function (basically arbitrary precision modulus operator)
in JavaScript. So I went to jsphp.co to download it, only to discover
that this function hadn't been implemented yet. So I implemented it.

Over the course of the evening I went from my first version at
2012-03-16 19:27 UTC:


To a version that I felt comfortable releasing by 2012-03-17 02:09 UTC:


So about six hours, you can see my progress here:


And you can see the diff between the first and last versions here:


I configured bcmod to use the 'abs' and 'array_reverse' functions as


I wrote 50 unit tests:


And they all pass:


It feels so good having the infrastructure I need to get things done in
place, and now I have my bcmod function, and jsphp.co is just that
little bit better.


p.s. if you think my code stinks and you could do a better job of
commenting or picking variable names or algorithms then swing by and
create yourself an account and get hacking! http://jsphp.co/

More information about the programming mailing list