Changes in progress, added calculations for FinDiff greeks
This commit is contained in:
12
src/utils.c
12
src/utils.c
@@ -1,5 +1,10 @@
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#define M_PI 3.14159265358979323846264338327950288
|
||||
|
||||
|
||||
double normalcdf(double z)
|
||||
{
|
||||
@@ -23,6 +28,13 @@ double normalcdf(double z)
|
||||
return 0.5 * (1 + sign * y);
|
||||
}
|
||||
|
||||
|
||||
double normalpdf(double z)
|
||||
{
|
||||
return exp(-0.5 * pow(z, 2)) / pow(M_PI * 2, 0.5);
|
||||
}
|
||||
|
||||
|
||||
double gaussrand()
|
||||
{
|
||||
/* Marsaglia and Bray, ``A Convenient Method for Generating Normal Variables'' */
|
||||
|
||||
Reference in New Issue
Block a user