~ubuntu-branches/ubuntu/utopic/pgadmin3/utopic-proposed

« back to all changes in this revision

Viewing changes to pgadmin/pgscript/utilities/m_apm/mapmhasn.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2011-06-07 23:03:54 UTC
  • mfrom: (1.3.1 upstream) (13 sid)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20110607230354-3td4j9y71u4ahcvj
Tags: 1.14.0~beta1-1
* New upstream development release, adding Build-Depends on
  postgresql-server-dev-all >= 117~.
* Add Build-Depends on quilt, (un)patch to debian/rules and patch for fixing
  the include for kwlist.h in pgadmin/db/keywords.c.
* Add pg_config --includedir-server output to CPPFLAGS.
* Remove unrecognized configure options: --with-wx-config,
  --with-pgsql-include, --enable-gtk2, --enable-unicode.
* Clean up manually the files that are left behind after the broken
  distclean.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
 
/* 
 
2
/*
3
3
 *  M_APM  -  mapmhasn.c
4
4
 *
5
5
 *  Copyright (C) 2000 - 2007   Michael C. Ring
34
34
 */
35
35
void    m_apm_arcsinh(M_APM rr, int places, M_APM aa)
36
36
{
37
 
M_APM   tmp0, tmp1, tmp2;
38
 
 
39
 
/* result is 0 if input is 0 */
40
 
 
41
 
if (aa->m_apm_sign == 0)
42
 
  {
43
 
   M_set_to_zero(rr);
44
 
   return;
45
 
  }
46
 
 
47
 
tmp0 = M_get_stack_var();
48
 
tmp1 = M_get_stack_var();
49
 
tmp2 = M_get_stack_var();
50
 
 
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);
57
 
 
58
 
rr->m_apm_sign = aa->m_apm_sign;                          /* fix final sign */
59
 
 
60
 
M_restore_stack(3);
 
37
        M_APM   tmp0, tmp1, tmp2;
 
38
 
 
39
        /* result is 0 if input is 0 */
 
40
 
 
41
        if (aa->m_apm_sign == 0)
 
42
        {
 
43
                M_set_to_zero(rr);
 
44
                return;
 
45
        }
 
46
 
 
47
        tmp0 = M_get_stack_var();
 
48
        tmp1 = M_get_stack_var();
 
49
        tmp2 = M_get_stack_var();
 
50
 
 
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);
 
57
 
 
58
        rr->m_apm_sign = aa->m_apm_sign;                          /* fix final sign */
 
59
 
 
60
        M_restore_stack(3);
61
61
}
62
62
/****************************************************************************/
63
63
/*
67
67
 */
68
68
void    m_apm_arccosh(M_APM rr, int places, M_APM aa)
69
69
{
70
 
M_APM   tmp1, tmp2;
71
 
int     ii;
72
 
 
73
 
ii = m_apm_compare(aa, MM_One);
74
 
 
75
 
if (ii == -1)       /* x < 1 */
76
 
  {
77
 
   M_apm_log_error_msg(M_APM_RETURN, "\'m_apm_arccosh\', Argument < 1");
78
 
   M_set_to_zero(rr);
79
 
   return;
80
 
  }
81
 
 
82
 
tmp1 = M_get_stack_var();
83
 
tmp2 = M_get_stack_var();
84
 
 
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);
90
 
 
91
 
M_restore_stack(2);
 
70
        M_APM   tmp1, tmp2;
 
71
        int     ii;
 
72
 
 
73
        ii = m_apm_compare(aa, MM_One);
 
74
 
 
75
        if (ii == -1)       /* x < 1 */
 
76
        {
 
77
                M_apm_log_error_msg(M_APM_RETURN, "\'m_apm_arccosh\', Argument < 1");
 
78
                M_set_to_zero(rr);
 
79
                return;
 
80
        }
 
81
 
 
82
        tmp1 = M_get_stack_var();
 
83
        tmp2 = M_get_stack_var();
 
84
 
 
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);
 
90
 
 
91
        M_restore_stack(2);
92
92
}
93
93
/****************************************************************************/
94
94
/*
98
98
 */
99
99
void    m_apm_arctanh(M_APM rr, int places, M_APM aa)
100
100
{
101
 
M_APM   tmp1, tmp2, tmp3;
102
 
int     ii, local_precision;
103
 
 
104
 
tmp1 = M_get_stack_var();
105
 
 
106
 
m_apm_absolute_value(tmp1, aa);
107
 
 
108
 
ii = m_apm_compare(tmp1, MM_One);
109
 
 
110
 
if (ii >= 0)       /* |x| >= 1.0 */
111
 
  {
112
 
   M_apm_log_error_msg(M_APM_RETURN, "\'m_apm_arctanh\', |Argument| >= 1");
113
 
   M_set_to_zero(rr);
114
 
   M_restore_stack(1);
115
 
   return;
116
 
  }
117
 
 
118
 
tmp2 = M_get_stack_var();
119
 
tmp3 = M_get_stack_var();
120
 
 
121
 
local_precision = places + 8;
122
 
 
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);
129
 
 
130
 
M_restore_stack(3);
 
101
        M_APM   tmp1, tmp2, tmp3;
 
102
        int     ii, local_precision;
 
103
 
 
104
        tmp1 = M_get_stack_var();
 
105
 
 
106
        m_apm_absolute_value(tmp1, aa);
 
107
 
 
108
        ii = m_apm_compare(tmp1, MM_One);
 
109
 
 
110
        if (ii >= 0)       /* |x| >= 1.0 */
 
111
        {
 
112
                M_apm_log_error_msg(M_APM_RETURN, "\'m_apm_arctanh\', |Argument| >= 1");
 
113
                M_set_to_zero(rr);
 
114
                M_restore_stack(1);
 
115
                return;
 
116
        }
 
117
 
 
118
        tmp2 = M_get_stack_var();
 
119
        tmp3 = M_get_stack_var();
 
120
 
 
121
        local_precision = places + 8;
 
122
 
 
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);
 
129
 
 
130
        M_restore_stack(3);
131
131
}
132
132
/****************************************************************************/