~ubuntu-branches/ubuntu/trusty/mingw-w64/trusty

« back to all changes in this revision

Viewing changes to mingw-w64-crt/complex/ctanhl.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Kitt
  • Date: 2010-11-18 00:04:46 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101118000446-97dmza5x49sv6s4l
Tags: 1.0+20101003-1
* New maintainer. (Closes: #594371.)
* New upstream snapshot:
  - Includes getopt.h. (Closes: #569914.)
* Build g++ for Win64. (Closes: #600451.)
* Standards-Version 3.9.1 (new packaging).
* Include patch from
  http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64?view=revision&revision=3715
  as suggested by Rafaël Carré.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * This file has no copyright assigned and is placed in the Public Domain.
3
 
 * This file is part of the w64 mingw-runtime package.
4
 
 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
 
 */
6
 
/*
7
 
   Contributed by Danny Smith
8
 
   2005-01-04
9
 
*/
10
 
 
11
 
 
12
 
#include <math.h>
13
 
#include <complex.h>
14
 
#include <errno.h>
15
 
 
16
 
/*
17
 
  ctanh (x + I * y) = (sinh (2 * x)  +  sin (2 * y) * I )
18
 
                     / (cosh (2 * x) + cos (2 * y)) .
19
 
*/
20
 
 
21
 
long double complex
22
 
ctanhl (long double complex Z)
23
 
{
24
 
  long double complex Res;
25
 
  long double two_R = 2.0L * __real__ Z;
26
 
  long double two_I = 2.0L * __imag__ Z;
27
 
  long double denom = coshl (two_R) + cosl (two_I);
28
 
 
29
 
  if (denom == 0.0L)
30
 
    {
31
 
      errno = ERANGE;
32
 
      __real__ Res = HUGE_VALL;
33
 
      __imag__ Res = HUGE_VALL;
34
 
    }
35
 
  else if (isinf (denom))
36
 
    {
37
 
      errno = ERANGE;
38
 
      __real__ Res = two_R > 0 ? 1.0L : -1.0L;
39
 
      __imag__ Res = 0.0L;
40
 
    }
41
 
  else
42
 
    {
43
 
      __real__ Res = sinhl (two_R) / denom;
44
 
      __imag__ Res = sinl (two_I) / denom;
45
 
    }
46
 
  return Res;
47
 
}
 
1
/**
 
2
 * This file has no copyright assigned and is placed in the Public Domain.
 
3
 * This file is part of the w64 mingw-runtime package.
 
4
 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 
5
 */
 
6
/*
 
7
   Contributed by Danny Smith
 
8
   2005-01-04
 
9
*/
 
10
 
 
11
 
 
12
#include <math.h>
 
13
#include <complex.h>
 
14
#include <errno.h>
 
15
 
 
16
/*
 
17
  ctanh (x + I * y) = (sinh (2 * x)  +  sin (2 * y) * I )
 
18
                     / (cosh (2 * x) + cos (2 * y)) .
 
19
*/
 
20
 
 
21
long double complex
 
22
ctanhl (long double complex Z)
 
23
{
 
24
  long double complex Res;
 
25
  long double two_R = 2.0L * __real__ Z;
 
26
  long double two_I = 2.0L * __imag__ Z;
 
27
  long double denom = coshl (two_R) + cosl (two_I);
 
28
 
 
29
  if (denom == 0.0L)
 
30
    {
 
31
      errno = ERANGE;
 
32
      __real__ Res = HUGE_VALL;
 
33
      __imag__ Res = HUGE_VALL;
 
34
    }
 
35
  else if (isinf (denom))
 
36
    {
 
37
      errno = ERANGE;
 
38
      __real__ Res = two_R > 0 ? 1.0L : -1.0L;
 
39
      __imag__ Res = 0.0L;
 
40
    }
 
41
  else
 
42
    {
 
43
      __real__ Res = sinhl (two_R) / denom;
 
44
      __imag__ Res = sinl (two_I) / denom;
 
45
    }
 
46
  return Res;
 
47
}