| >It can do almost everything I can do a bit better At this particular point in time, I would not worry too much about getting replaced by an AI. To wit: > Please write me a C++ program to compute the 1000000-th decimal of pi
GPT-4 answers:
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
int n = 1000000;
int k, j;
double pi = 0.0;
double denom;
for (k = 0; k < n; k++) {
denom = 8.0 * k + 1.0;
pi += (1.0 / pow(16.0, k)) * (
4.0 / denom -
2.0 / (denom + 2.0) -
1.0 / (denom + 3.0) -
1.0 / (denom + 4.0)
);
}
pi = pi - floor(pi);
pi *= pow(10.0, 6);
cout << fixed << setprecision(0) << pi << endl;
return 0;
}
The code is totally broken: GPT-4 entirely fails to understand that floats have limited precision.It's cool (and very helpful) that it can regurgitate Plouffe's algorithm (although I haven't checked that the algo in the answer is correct), but to me, this example clearly proves that GPT-4 is simply a parrot with a very large memory that does not understand anything it does. A glorified hash table with a very sophisticated compression and retrieval algorithm, but a very far cry from AGI. It's going to allow us to build a much better search engine, a great coding assistant, it will enhance your productivity as a programmer, but it is - so far - altogether incapable of replacing you: it does not understand what it's doing. [EDIT 1]: I checked Plouffe's formulas and GPT-4 gets it wrong: Plouffe formula's key feature is that it yields binary or decimal digits of pi directly [1] (no iteration required), so ... why does GPT-4 loop a million time to produce the answer, ... meh. [1] http://plouffe.fr/NEW/A%20formula%20for%20the%20n%27th%20dig... [EDIT 2]: oh, and, I just tried to same example on Bard, it fares way, way worse than GPT-4: #include <iostream>
#include <iomanip>
using namespace std;
int main() {
// Calculate the first 1000000 decimal places of pi.
double pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;
// Write the first 1000000 decimal places of pi to the console.
for (int i = 0; i < 1000000; i++) {
cout << setprecision(10) << pi << " ";
}
return 0;
}
These things are impressive, but they have a very long way to go.Worst of all: they seem at this point incapable of verifying the consistency of their answers, correct and iterate until they at least output something vaguely coherent. |