Mega Search
23.2 Million


Sign Up

Make a donation  
math erf function?  
News Group: embarcadero.public.cppbuilder.language.cpp

Hi,
I'm trying to find the erf() function using C++ builder XE3, but can't 
find it.

Anyone knowing if its available?
tk

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 28-Jan-2014, at 12:58 PM EST
From: totte karlsson
 
Re: math erf function?  
News Group: embarcadero.public.cppbuilder.language.cpp
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

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 28-Jan-2014, at 2:12 PM EST
From: Asger Joergensen
 
Re: math erf function?  
News Group: embarcadero.public.cppbuilder.language.cpp
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
>

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 28-Jan-2014, at 2:57 PM EST
From: totte karlsson