Function: bcmod version 466

Function:
Description: Get the modulus of the left_operand using modulus.
Version:
Status: obsolete
Date: 2012-03-16 19:51
Summary: Switching result from string to float.
Programmer: jj5
Code
1
2
3
4
5
6
7
8
9
10
11
function bcmod( left_operand, modulus ) {
  modulus = abs( parseFloat( modulus ) ).toString();
  var result = 0;
  var read = 1;
  do {
    result = ( result + parseInt( left_operand.substr( 0, read ) ) ) % modulus;
    left_operand = left_operand.substr( read );
  }
  while ( left_operand.length > 0 );
  return result.toString();
}
[top]

Comments

There are no comments yet, be the first!

Please Login or Register to post comments.