Loss of Precision and For Loops
2 views (last 30 days)
Show older comments
My program has to preform a task an N-factorial number of times. Besides the obvious problems involving computational time, I was wondering how the loss of precision of very large numbers affected the number of times that my program went through the loop. If I have a number like 25 factorial, it doesn't have accuracy down to the ones place. So if I needed my program to run through a process 25! times, would it actually attempt to do it 25!, or would it round off somewhere?
So if I wrote
for i = 1 : factorial ( 25 )
would the loop run through 25! times or would it round down to another number?
0 Comments
Accepted Answer
Walter Roberson
on 1 Apr 2013
It would round it off.
... You do realize that it would require approximately half a billion years if you were able to operate at 1 billion iterations per second ????
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!