delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/03/20/12:43:43

From: John Carter <ECE AT dwaf-hri DOT pwv DOT gov DOT za>
Organization: Dpt Water Affairs & Forestry (IWQS)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Mon, 20 Mar 1995 07:52:17 +0200
Subject: Re: erf, and the *rand48 functions

>The linker complains about these functions with an "unresolved externals"
>message.  
>
>If they're unimplemented, can you tell me where I can get online sources
>for them?  (My Abramowitz & Stegun is in storage...
I couldn't find them either, except as headers in the .h file, so 
here is something I created/took from A&S...

#include <math.h>
double erf( double x)
{
  const double a1 = 0.3480242, a2=-0.0958798, a3=0.7478556, p=0.47047;
  double t;

  if( x < 0.0) return -erf( -x);
  t = 1.0 / ( 1.0 + p * x);
  return 1.0 - t * (a1 + t * (a2 + a3 * t)) * exp( -x * x);
}

Hope it helps...

John Carter
Institute for Water Quality Studies. Department of Water Affairs.
Internet : ece AT dwaf-hri DOT pwv DOT gov DOT za
Phone    : 27-12-808-0374x194      Fax : 27-12-808-0338

Thought for the day:
    A penny saved is ridiculous.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019