Skip to content

Commit

Permalink
now the black scholes C99 sequential do not use the pow() function
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Jul 12, 2016
1 parent 6393bbf commit 90f46d3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions benchmarks/black_scholes/c99_seq/src/black_scholes.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ double cnd( double x )

L = fabs(x);
K = 1.0 / (1.0 + 0.2316419 * L);
double K2 = K*K;
double K4 = K2*K2;
w = 1.0 - 1.0 / sqrt(2 * M_PI) * exp(-L *L / 2) * (\
a1 * K + \
a2 * pow(K, 2) + \
a3 * pow(K, 3) + \
a4 * pow(K, 4) + \
a5 * pow(K, 5)
a2 * K2 + \
a3 * K*K2 + \
a4 * K4 + \
a5 * K*K4
);

return (x<0) ? 1.0 - w : w;
Expand Down

0 comments on commit 90f46d3

Please sign in to comment.