Function: bcmod version 462

Function:
Description: Get the modulus of the left_operand using modulus.
Version:
Status: obsolete
Date: 2012-03-16 19:27
Summary: New bcmod implementation based on my_bcmod here: http://php.net/manual/en/function.bcmod.php
Programmer: jj5
Code
1
2
3
4
5
6
7
8
9
10
11
12
function bcmod( left_operand, modulus ) {
  modulus = abs( parseInt( modulus ) ).toString();
  var result = '';
  var read = 9;
  do {
    var i = parseInt( result + left_operand.substr( 0, read ) );
    left_operand = left_operand.substr( read );
    result = ( i % modulus ).toString();
  }
  while ( left_operand.length > 0 );
  return result;
}
[top]

Comments

There are no comments yet, be the first!

Please Login or Register to post comments.