Hi totte
totte karlsson wrote:
> Hi,
> I'm trying to find the erf() function using C++ builder XE3, but can't
> find it.
The only one I have in CB2009 is boost::math::erf
Not really an answer, but if you have boost in XE3, that might be where
you should look mine is in this file:
CodeGear\include\boost_1_35\boost\math\special_functions\erf.hpp
Best regards
Asger-P
Thanks Asger,
I ended up implementing my own approximate erf function from some php
code online, as
double erf(double x)
{
double pi = 3.1415927;
double a = (8.*(pi - 3.))/(3.*pi*(4. - pi));
double x2 = x * x;
double ax2 = a * x2;
double num = (4./pi) + ax2;
double denom = 1.0 + ax2;
double inner = (-1. * x2)* num/ denom;
double erf2 = 1.0 - exp(inner);
return sqrt(erf2);
}
Too many bad experiences with boost and codegear so I'm staying away
from that..! :)
tk
>
> The only one I have in CB2009 is boost::math::erf
>
> Not really an answer, but if you have boost in XE3, that might be where
> you should look mine is in this file:
> CodeGear\include\boost_1_35\boost\math\special_functions\erf.hpp
>
> Best regards
> Asger-P
>