35
35
void m_apm_arcsinh(M_APM rr, int places, M_APM aa)
37
M_APM tmp0, tmp1, tmp2;
39
/* result is 0 if input is 0 */
41
if (aa->m_apm_sign == 0)
47
tmp0 = M_get_stack_var();
48
tmp1 = M_get_stack_var();
49
tmp2 = M_get_stack_var();
51
m_apm_absolute_value(tmp0, aa);
52
m_apm_multiply(tmp1, tmp0, tmp0);
53
m_apm_add(tmp2, tmp1, MM_One);
54
m_apm_sqrt(tmp1, (places + 6), tmp2);
55
m_apm_add(tmp2, tmp0, tmp1);
56
m_apm_log(rr, places, tmp2);
58
rr->m_apm_sign = aa->m_apm_sign; /* fix final sign */
37
M_APM tmp0, tmp1, tmp2;
39
/* result is 0 if input is 0 */
41
if (aa->m_apm_sign == 0)
47
tmp0 = M_get_stack_var();
48
tmp1 = M_get_stack_var();
49
tmp2 = M_get_stack_var();
51
m_apm_absolute_value(tmp0, aa);
52
m_apm_multiply(tmp1, tmp0, tmp0);
53
m_apm_add(tmp2, tmp1, MM_One);
54
m_apm_sqrt(tmp1, (places + 6), tmp2);
55
m_apm_add(tmp2, tmp0, tmp1);
56
m_apm_log(rr, places, tmp2);
58
rr->m_apm_sign = aa->m_apm_sign; /* fix final sign */
62
62
/****************************************************************************/
68
68
void m_apm_arccosh(M_APM rr, int places, M_APM aa)
73
ii = m_apm_compare(aa, MM_One);
75
if (ii == -1) /* x < 1 */
77
M_apm_log_error_msg(M_APM_RETURN, "\'m_apm_arccosh\', Argument < 1");
82
tmp1 = M_get_stack_var();
83
tmp2 = M_get_stack_var();
85
m_apm_multiply(tmp1, aa, aa);
86
m_apm_subtract(tmp2, tmp1, MM_One);
87
m_apm_sqrt(tmp1, (places + 6), tmp2);
88
m_apm_add(tmp2, aa, tmp1);
89
m_apm_log(rr, places, tmp2);
73
ii = m_apm_compare(aa, MM_One);
75
if (ii == -1) /* x < 1 */
77
M_apm_log_error_msg(M_APM_RETURN, "\'m_apm_arccosh\', Argument < 1");
82
tmp1 = M_get_stack_var();
83
tmp2 = M_get_stack_var();
85
m_apm_multiply(tmp1, aa, aa);
86
m_apm_subtract(tmp2, tmp1, MM_One);
87
m_apm_sqrt(tmp1, (places + 6), tmp2);
88
m_apm_add(tmp2, aa, tmp1);
89
m_apm_log(rr, places, tmp2);
93
93
/****************************************************************************/
99
99
void m_apm_arctanh(M_APM rr, int places, M_APM aa)
101
M_APM tmp1, tmp2, tmp3;
102
int ii, local_precision;
104
tmp1 = M_get_stack_var();
106
m_apm_absolute_value(tmp1, aa);
108
ii = m_apm_compare(tmp1, MM_One);
110
if (ii >= 0) /* |x| >= 1.0 */
112
M_apm_log_error_msg(M_APM_RETURN, "\'m_apm_arctanh\', |Argument| >= 1");
118
tmp2 = M_get_stack_var();
119
tmp3 = M_get_stack_var();
121
local_precision = places + 8;
123
m_apm_add(tmp1, MM_One, aa);
124
m_apm_subtract(tmp2, MM_One, aa);
125
m_apm_divide(tmp3, local_precision, tmp1, tmp2);
126
m_apm_log(tmp2, local_precision, tmp3);
127
m_apm_multiply(tmp1, tmp2, MM_0_5);
128
m_apm_round(rr, places, tmp1);
101
M_APM tmp1, tmp2, tmp3;
102
int ii, local_precision;
104
tmp1 = M_get_stack_var();
106
m_apm_absolute_value(tmp1, aa);
108
ii = m_apm_compare(tmp1, MM_One);
110
if (ii >= 0) /* |x| >= 1.0 */
112
M_apm_log_error_msg(M_APM_RETURN, "\'m_apm_arctanh\', |Argument| >= 1");
118
tmp2 = M_get_stack_var();
119
tmp3 = M_get_stack_var();
121
local_precision = places + 8;
123
m_apm_add(tmp1, MM_One, aa);
124
m_apm_subtract(tmp2, MM_One, aa);
125
m_apm_divide(tmp3, local_precision, tmp1, tmp2);
126
m_apm_log(tmp2, local_precision, tmp3);
127
m_apm_multiply(tmp1, tmp2, MM_0_5);
128
m_apm_round(rr, places, tmp1);
132
132
/****************************************************************************/