daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest May 20th, 2018 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. double bernoulli[] = { 1/6, 1/30, ... , 236464091/2730 };
  2.  
  3. double coth(double x, double epsilon)
  4. {
  5.    double last_n = x/3;
  6.    double sum = last_n;
  7.    double n = 0;
  8.    
  9.    for(int i = 2; i<=12, i++)
  10.    {
  11.        n = (pow(-1,i+1)*pow(2, 2*i))/faculty(2*i) * bernoulli[i] * pow(x, 2*i-1)
  12.        sum += n;
  13.        if((n < epsilon) && (last_n < epsilon))
  14.            return sum;
  15.      
  16.    }
  17.    return sum;
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top