support/fdlibm/w_atanh.c
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 31 Jan 2013 15:18:47 +0000
branchrefactoring-vmdata
changeset 2021 75e48299fc2d
parent 1818 2e5ed72e7dfd
child 2380 9195eccdcbd9
permissions -rw-r--r--
Added a number of unimplemented native methods.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
986
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
     1
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
     2
/* @(#)w_atanh.c 1.3 95/01/18 */
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
     3
/*
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
     4
 * ====================================================
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
     5
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
     6
 *
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
     7
 * Developed at SunSoft, a Sun Microsystems, Inc. business.
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
     8
 * Permission to use, copy, modify, and distribute this
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
     9
 * software is freely granted, provided that this notice 
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    10
 * is preserved.
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    11
 * ====================================================
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    12
 */
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    13
/* 
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    14
 * wrapper atanh(x)
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    15
 */
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    16
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    17
#include "fdlibm.h"
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    18
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    19
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    20
#ifdef __STDC__
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    21
	double atanh(double x)		/* wrapper atanh */
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    22
#else
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    23
	double atanh(x)			/* wrapper atanh */
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    24
	double x;
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    25
#endif
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    26
{
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    27
#ifdef _IEEE_LIBM
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    28
	return __ieee754_atanh(x);
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    29
#else
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    30
	double z,y;
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    31
	z = __ieee754_atanh(x);
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    32
	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    33
	y = fabs(x);
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    34
	if(y>=1.0) {
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    35
	    if(y>1.0)
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    36
	        return __kernel_standard(x,x,30); /* atanh(|x|>1) */
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    37
	    else 
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    38
	        return __kernel_standard(x,x,31); /* atanh(|x|==1) */
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    39
	} else
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    40
	    return z;
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    41
#endif
a53b146a146d Added fdlibm for IEE754-style double arithmetics
vranyj1
parents:
diff changeset
    42
}