mirror of
https://github.com/ArashPartow/exprtk.git
synced 2025-06-12 16:27:23 +00:00
C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html
This commit is contained in:
@ -32,9 +32,9 @@ void black_scholes_merton_model()
|
||||
" var d1 := (log(s / x) + (r + v^2 / 2) * t) / (v * sqrt(t)); "
|
||||
" var d2 := d1 - v * sqrt(t); "
|
||||
" "
|
||||
" if(callput_flag == 'call') "
|
||||
" if (callput_flag == 'call') "
|
||||
" s * ncdf(d1) - x * e^(-r * t) * ncdf(d2); "
|
||||
" else if(callput_flag == 'put') "
|
||||
" else if (callput_flag == 'put') "
|
||||
" x * e^(-r * t) * ncdf(-d2) - s * ncdf(-d1); "
|
||||
" ";
|
||||
|
||||
@ -66,6 +66,7 @@ void black_scholes_merton_model()
|
||||
|
||||
{
|
||||
callput_flag = "call";
|
||||
|
||||
T bsm = expression.value();
|
||||
|
||||
printf("BSM(%s,%5.3f,%5.3f,%5.3f,%5.3f,%5.3f) = %10.6f\n",
|
||||
@ -76,6 +77,7 @@ void black_scholes_merton_model()
|
||||
|
||||
{
|
||||
callput_flag = "put";
|
||||
|
||||
T bsm = expression.value();
|
||||
|
||||
printf("BSM(%s,%5.3f,%5.3f,%5.3f,%5.3f,%5.3f) = %10.6f\n",
|
||||
|
Reference in New Issue
Block a user