Pi: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 3,513: | Line 3,513: | ||
Calling for 60 digit output does not produce 60 digits of precision. Once the sixteen digit precision of double precision is reached, the subsequent digits are determined by the workings of the binary to decimal conversion. The long decimal string is the exact decimal value of the binary representation of pi, which binary value is itself not exact because pi cannot be represented in a finite number of digits, be they decimal, binary or any other integer base... |
Calling for 60 digit output does not produce 60 digits of precision. Once the sixteen digit precision of double precision is reached, the subsequent digits are determined by the workings of the binary to decimal conversion. The long decimal string is the exact decimal value of the binary representation of pi, which binary value is itself not exact because pi cannot be represented in a finite number of digits, be they decimal, binary or any other integer base... |
||
=={{header|Nanoquery}}== |
|||
{{trans|Java}} |
|||
<lang Nanoquery>q = 1; r = 0; t = 1 |
|||
k = 1; n = 3; l = 3 |
|||
nn = null; nr = null |
|||
first = true |
|||
while true |
|||
if (((4 * q) + r) - t) < (n * t) |
|||
print n |
|||
if first |
|||
print "." |
|||
first = false |
|||
end |
|||
nr = int(10 * (r - (n * t))) |
|||
n = int((10 * ((3 * q) + r)) / t) - (10 * n) |
|||
q *= 10 |
|||
r = nr |
|||
else |
|||
nr = int(((2 * q) + r) * l) |
|||
nn = int((((q * (7 * k)) + 2) + (r * l)) / (t * l)) |
|||
q *= k |
|||
t *= l |
|||
l += 2 |
|||
k += 1 |
|||
n = nn |
|||
r = nr |
|||
end if |
|||
end while</lang> |
|||
{{out}} |
|||
<pre> |
|||
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679... |
|||
</pre> |
|||
=={{header|NetRexx}}== |
=={{header|NetRexx}}== |