~ubuntu-branches/debian/sid/pgadmin3/sid

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2009-07-30 12:27:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730122716-fddbh42on721bbs2
Tags: 1.10.0-1
* New upstream release.
* Adjusted watch file to match release candidates.
* Updated to Standards-Version 3.8.2:
  - Moved to Section: database.
  - Add DEB_BUILD_OPTIONS support for parallel building.
  - Move from findstring to filter suggestion for DEB_BUILD_OPTIONS parsing.
* pgagent got split into its own separate source package by upstream.
* Exclude Docs.vcproj from installation.
* Move doc-base.enus from pgadmin3 to pgadmin3-data package, the files are
  in there too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* 
 
3
 *  M_APM  -  mapmhsin.c
 
4
 *
 
5
 *  Copyright (C) 2000 - 2007   Michael C. Ring
 
6
 *
 
7
 *  Permission to use, copy, and distribute this software and its
 
8
 *  documentation for any purpose with or without fee is hereby granted,
 
9
 *  provided that the above copyright notice appear in all copies and
 
10
 *  that both that copyright notice and this permission notice appear
 
11
 *  in supporting documentation.
 
12
 *
 
13
 *  Permission to modify the software is granted. Permission to distribute
 
14
 *  the modified code is granted. Modifications are to be distributed by
 
15
 *  using the file 'license.txt' as a template to modify the file header.
 
16
 *  'license.txt' is available in the official MAPM distribution.
 
17
 *
 
18
 *  This software is provided "as is" without express or implied warranty.
 
19
 */
 
20
 
 
21
/*
 
22
 *
 
23
 *      This file contains the Hyperbolic SIN, COS, & TAN functions.
 
24
 */
 
25
 
 
26
#include "pgAdmin3.h"
 
27
#include "pgscript/utilities/mapm-lib/m_apm_lc.h"
 
28
 
 
29
/****************************************************************************/
 
30
/*
 
31
 *      sinh(x) == 0.5 * [ exp(x) - exp(-x) ]
 
32
 */
 
33
void    m_apm_sinh(M_APM rr, int places, M_APM aa)
 
34
{
 
35
M_APM   tmp1, tmp2, tmp3;
 
36
int     local_precision;
 
37
 
 
38
tmp1 = M_get_stack_var();
 
39
tmp2 = M_get_stack_var();
 
40
tmp3 = M_get_stack_var();
 
41
 
 
42
local_precision = places + 4;
 
43
 
 
44
m_apm_exp(tmp1, local_precision, aa);
 
45
m_apm_reciprocal(tmp2, local_precision, tmp1);
 
46
m_apm_subtract(tmp3, tmp1, tmp2);
 
47
m_apm_multiply(tmp1, tmp3, MM_0_5);
 
48
m_apm_round(rr, places, tmp1);
 
49
 
 
50
M_restore_stack(3);
 
51
}
 
52
/****************************************************************************/
 
53
/*
 
54
 *      cosh(x) == 0.5 * [ exp(x) + exp(-x) ]
 
55
 */
 
56
void    m_apm_cosh(M_APM rr, int places, M_APM aa)
 
57
{
 
58
M_APM   tmp1, tmp2, tmp3;
 
59
int     local_precision;
 
60
 
 
61
tmp1 = M_get_stack_var();
 
62
tmp2 = M_get_stack_var();
 
63
tmp3 = M_get_stack_var();
 
64
 
 
65
local_precision = places + 4;
 
66
 
 
67
m_apm_exp(tmp1, local_precision, aa);
 
68
m_apm_reciprocal(tmp2, local_precision, tmp1);
 
69
m_apm_add(tmp3, tmp1, tmp2);
 
70
m_apm_multiply(tmp1, tmp3, MM_0_5);
 
71
m_apm_round(rr, places, tmp1);
 
72
 
 
73
M_restore_stack(3);
 
74
}
 
75
/****************************************************************************/
 
76
/*
 
77
 *      tanh(x) == [ exp(x) - exp(-x) ]  /  [ exp(x) + exp(-x) ]
 
78
 */
 
79
void    m_apm_tanh(M_APM rr, int places, M_APM aa)
 
80
{
 
81
M_APM   tmp1, tmp2, tmp3, tmp4;
 
82
int     local_precision;
 
83
 
 
84
tmp1 = M_get_stack_var();
 
85
tmp2 = M_get_stack_var();
 
86
tmp3 = M_get_stack_var();
 
87
tmp4 = M_get_stack_var();
 
88
 
 
89
local_precision = places + 4;
 
90
 
 
91
m_apm_exp(tmp1, local_precision, aa);
 
92
m_apm_reciprocal(tmp2, local_precision, tmp1);
 
93
m_apm_subtract(tmp3, tmp1, tmp2);
 
94
m_apm_add(tmp4, tmp1, tmp2);
 
95
m_apm_divide(tmp1, local_precision, tmp3, tmp4);
 
96
m_apm_round(rr, places, tmp1);
 
97
 
 
98
M_restore_stack(4);
 
99
}
 
100
/****************************************************************************/