How to use erf() function to get the error function value for N in C++

1 Answer

0 votes
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	cout << "erf(-1) = " << erf(-1) << endl;
	cout << "erf(1) = " << erf(1) << endl;
	cout << "erf(0) = " << erf(0) << endl;
	cout << "erf(-0) = " << erf(-0) << endl;

	return 0;
}

/*
run:

erf(-1) = -0.842701
erf(1) = 0.842701
erf(0) = 0
erf(-0) = 0

*/

 



answered Mar 15, 2016 by avibootz
...