how to calculate modulus in matlab ?
42 views (last 30 days)
the question seems simple as using mod works for small numbers not for large numbers.
i want to calculate mod( (4^15)*(21^13),47) the matlab ans= 21 but the correct ans = 3 using the windows calculator. is there any way in matlab to calculate such modulus ?
Thanks in advance.
More Answers (3)
Roger Stafford on 15 May 2013
The number you describe is far too large for accurate numerical computation using only 'double' floating points numbers. However, the 'mod' function also works with symbolic numbers using the symbolic toolbox. You can compute with these to any accuracy you wish.
Walter Roberson on 15 May 2013
mod(mod( (4^15), 47) * mod((21^13),47), 47)