Skip to main content
Code Review

Return to Question

added 113 characters in body
Source Link
Tobi
  • 241
  • 1
  • 7

Is this an efficient way to compute the value of Pi, where the limit of j \$\propto\$ accuracy?

PI = 0;
for (var j = 1; j < 100; j+=2) PI += (4/j)*((j+1)%4?1:-1);

The formula I used to write this is:

$$\pi \equiv \frac{4}{1}-\frac{4}{3}+\frac{4}{5}-\frac{4}{7}+\cdots$$

Is this an efficient way to compute the value of Pi, where the limit of j \$\propto\$ accuracy?

PI = 0;
for (var j = 1; j < 100; j+=2) PI += (4/j)*((j+1)%4?1:-1);

Is this an efficient way to compute the value of Pi, where the limit of j \$\propto\$ accuracy?

PI = 0;
for (var j = 1; j < 100; j+=2) PI += (4/j)*((j+1)%4?1:-1);

The formula I used to write this is:

$$\pi \equiv \frac{4}{1}-\frac{4}{3}+\frac{4}{5}-\frac{4}{7}+\cdots$$

added 4 characters in body
Source Link
Tobi
  • 241
  • 1
  • 7

Is this an efficient way to getcompute the value of Pi, where the limit of j \$\propto\$ accuracy?

PI = 0;
for (var j = 1; j < 100; j+=2) PI += (4/j)*((j+1)%4?1:-1);

Is this an efficient way to get the value of Pi, where the limit of j \$\propto\$ accuracy?

PI = 0;
for (var j = 1; j < 100; j+=2) PI += (4/j)*((j+1)%4?1:-1);

Is this an efficient way to compute the value of Pi, where the limit of j \$\propto\$ accuracy?

PI = 0;
for (var j = 1; j < 100; j+=2) PI += (4/j)*((j+1)%4?1:-1);
added 10 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Is this an efficient way to get the value of Pi, where the limit of j \$\propto\$ accuracy?

PI = 0;
for (var j = 1; j < 100; j+=2) PI += (4/j)*((j+1)%4?1:-1);

Is this an efficient way to get the value of Pi, where the limit of j accuracy?

PI = 0;
for (var j = 1; j < 100; j+=2) PI += (4/j)*((j+1)%4?1:-1);

Is this an efficient way to get the value of Pi, where the limit of j \$\propto\$ accuracy?

PI = 0;
for (var j = 1; j < 100; j+=2) PI += (4/j)*((j+1)%4?1:-1);
added 13 characters in body
Source Link
Tobi
  • 241
  • 1
  • 7
Loading
deleted 23 characters in body; edited tags
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238
Loading
Source Link
Tobi
  • 241
  • 1
  • 7
Loading
default

AltStyle によって変換されたページ (->オリジナル) /