-
Description A really arcaic calculator for pi, that takes ages to get a little precision.
Code var ex431 = function(tries){ var inc=0, outc=0, x, y; while(tries>0){ x = Math.random(); y = Math.random(); if (x*x + y*y <= 1) inc++; else outc++; tries--; } return inc/(inc+outc); }
Test Cases Failed for(var i = 0; i<300; i++) console.log(ex431(100000000)*4);
Output:
-
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}