Skip to content

Commit 6bbf476

Browse files
committed
Fix typo
1 parent 072ddac commit 6bbf476

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tpool/tpool.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ int tpool_join(struct __threadpool *pool)
324324
#define PRECISION 100 /* upper bound in BPP sum */
325325

326326
/* Use Bailey–Borwein–Plouffe formula to approximate PI */
327-
static void *bpp(void *arg)
327+
static void *bbp(void *arg)
328328
{
329329
int k = *(int *) arg;
330330
double sum = (4.0 / (8 * k + 1)) - (2.0 / (8 * k + 4)) -
@@ -337,24 +337,24 @@ static void *bpp(void *arg)
337337

338338
int main()
339339
{
340-
int bpp_args[PRECISION + 1];
341-
double bpp_sum = 0;
340+
int bbp_args[PRECISION + 1];
341+
double bbp_sum = 0;
342342
tpool_t pool = tpool_create(4);
343343
tpool_future_t futures[PRECISION + 1];
344344

345345
for (int i = 0; i <= PRECISION; i++) {
346-
bpp_args[i] = i;
347-
futures[i] = tpool_apply(pool, bpp, (void *) &bpp_args[i]);
346+
bbp_args[i] = i;
347+
futures[i] = tpool_apply(pool, bbp, (void *) &bbp_args[i]);
348348
}
349349

350350
for (int i = 0; i <= PRECISION; i++) {
351351
double *result = tpool_future_get(futures[i], 0 /* blocking wait */);
352-
bpp_sum += *result;
352+
bbp_sum += *result;
353353
tpool_future_destroy(futures[i]);
354354
free(result);
355355
}
356356

357357
tpool_join(pool);
358-
printf("PI calculated with %d terms: %.15f\n", PRECISION + 1, bpp_sum);
358+
printf("PI calculated with %d terms: %.15f\n", PRECISION + 1, bbp_sum);
359359
return 0;
360360
}

0 commit comments

Comments
 (0)