Hello I am creating an app that calculates Pi(π) value. However, when I make a division it returns a number up to 6 digits. More details can be seen here:
There is a math block to show more digits, format as decimal
See the article in this FAQ for internal data types
It stills showing the same thing
Anyway I found how. Thanks ABG.
That's a thing of beauty!
Which series did you use?
(For the other board readers, here is the lazy reader version and video)
video:
This looks like Nilakantha 15th century ...
This is a good math challenge!
Yes, I used Nilakantha series
@ABG I was wantering if there's a way to do this a bit more fast, cause it seems calculating very slow.
See Juan Antonio's Rosetta code link further back in this thread.
That site's samples use different algorithms that you can try to code in AI2.
But know that this is a game you can't win, but only enjoy along the way.
22/7?
see I told you
Maybe 223/71 ?
Pi with JavaScript
borrar_pi_javascript.aia (2.2 KB)
http://ajennings.net/blog/a-million-digits-of-pi-in-9-lines-of-javascript.html
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"></head><body>
<p id="demo"></p>
<script>
let i = 1n;
let x = 3n * (10n ** 1020n);
let pi = x;
while (x > 0) {
x = x * i / ((i + 1n) * 4n);
pi += x / (i + 2n);
i += 2n;
}
window.AppInventor.setWebViewString("" +pi/(10n ** 20n)); // App Inventor
// document.getElementById("demo").innerHTML = pi/(10n ** 20n); // Web
</script>
</body></html>
I will use it. I am doing html
I am also planning to make a log for the output