Modulo on big numbers


/ Published in: ASP
Save to your folder(s)

Use this function to calculate modulo on numbers that overflow doubles.
Where "number" is the value you want to devide, and "div" is the number you want to devide by.


Copy this code and paste it in your HTML
  1. function modulo(number, div)
  2. tmp = ""
  3.  
  4. for i = 1 to len(number)
  5. tmp = tmp & mid(cStr(number), i, 1)
  6. r = cInt(tmp) mod div
  7. tmp = cStr(r)
  8. next
  9.  
  10. modulo = cInt(tmp)
  11. end function

Report this snippet


Comments


You need to login to view comments.