/[ascend]/trunk/base/generic/compiler/rounded.h
ViewVC logotype

Contents of /trunk/base/generic/compiler/rounded.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1066 - (show annotations) (download) (as text)
Sun Jan 7 10:02:41 2007 UTC (17 years, 9 months ago) by johnpye
File MIME type: text/x-chdr
File size: 9038 byte(s)
Adding doxygen 'addtogroup' for Solver, Compiler, Integrator.
1 /*
2 * Rounded Arithmetic Routines
3 * by Tom Epperly
4 * Version: $Revision: 1.6 $
5 * Version control file: $RCSfile: rounded.h,v $
6 * Date last modified: $Date: 1997/07/30 12:16:59 $
7 * Last modified by: $Author: mthomas $
8 * 6/28/89
9 *
10 * This file is part of the Ascend Language Interpreter.
11 *
12 * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
13 *
14 * The Ascend Language Interpreter is free software; you can redistribute
15 * it and/or modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * The Ascend Language Interpreter is distributed in hope that it will be
20 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with the program; if not, write to the Free Software Foundation, Inc., 675
26 * Mass Ave, Cambridge, MA 02139 USA. Check the file named COPYING.
27 */
28
29 /** @file
30 * Rounded Arithmetic Routines.
31 * <pre>
32 * When #including rounded.h, make sure these files are #included first:
33 * #include "utilities/ascConfig.h"
34 * </pre>
35 */
36
37 #ifndef ASC_ROUNDED_H
38 #define ASC_ROUNDED_H
39
40 /** addtogroup compiler Compiler
41 @{
42 */
43
44 extern double DIPow(register double d, long int n);
45 /**<
46 * <!-- double DIPow(d,n) -->
47 * <!-- double d; -->
48 * <!-- long n; -->
49 * Return d^n rounded downward.
50 */
51
52 extern double UIPow(register double d, long int n);
53 /**<
54 * <!-- double UIPow(d,n) -->
55 * <!-- double d; -->
56 * <!-- long n; -->
57 * Return d^n rounded upward.
58 */
59
60 #ifndef SLOPPY
61 extern double DPow(register double d1, register double d2);
62 /**<
63 * <!-- double DPow(d1,d2) -->
64 * <!-- double d1,d2; -->
65 * Return the downward rounded result of d1^d2(d1 raised to the power d2).
66 */
67
68 extern double UPow(register double d1, register double d2);
69 /**<
70 * <!-- double UPow(d1,d2) -->
71 * <!-- double d1,d2; -->
72 * Return the downward rounded result of d1^d2(d1 raised to the power d2).
73 */
74
75 extern double DPlus(register double d1, register double d2);
76 /**<
77 * <!-- double DPlus(d1,d2) -->
78 * <!-- double d1,d2; -->
79 * Return the downward rounded addition of d1 and d2.
80 */
81
82 extern double UPlus(register double d1, register double d2);
83 /**<
84 * <!-- double UPlus(d1,d2) -->
85 * <!-- double d1,d2; -->
86 * Return the upward rounded addition of d1 and d2.
87 */
88
89 extern double DMinus(register double d1, register double d2);
90 /**<
91 * <!-- double DMinus(d1,d2) -->
92 * <!-- double d1,d2; -->
93 * Return d1-d2 with downward rounding.
94 */
95
96 extern double UMinus(register double d1, register double d2);
97 /**<
98 * <!-- double UMinus(d1,d2) -->
99 * <!-- double d1,d2; -->
100 * Return d1-d2 with upward rounding.
101 */
102
103 extern double DTimes(register double d1, register double d2);
104 /**<
105 * <!-- double DTimes(d1,d2) -->
106 * <!-- double d1,d2; -->
107 * Return d1*d2 with downward rounding.
108 */
109
110 extern double UTimes(register double d1, register double d2);
111 /**<
112 * <!-- double UTimes(d1,d2) -->
113 * <!-- double d1,d2; -->
114 * Return d1*d2 with upward rounding.
115 */
116
117 extern double DDivide(register double d1, register double d2);
118 /**<
119 * <!-- double DDivide(d1,d2); -->
120 * <!-- double d1,d2; -->
121 * Return d1/d2 with downward rounding.
122 */
123
124 extern double UDivide(register double d1, register double d2);
125 /**<
126 * <!-- double UDivide(d1,d2); -->
127 * <!-- double d1,d2; -->
128 * Return d1/d2 with upward rounding.
129 */
130
131 extern double DSqr(register double d);
132 /**<
133 * <!-- double DSqr(d) -->
134 * <!-- double d; -->
135 * Return sqr(d) with downward rounding.
136 */
137
138 extern double USqr(register double d);
139 /**<
140 * <!-- double USqr(d) -->
141 * <!-- double d; -->
142 * Return sqr(d) with upward rounding.
143 */
144
145 extern double DSqrt(register double d);
146 /**<
147 * <!-- double DSqrt(d); -->
148 * <!-- double d; -->
149 * Return sqrt(d) with downward rounding.
150 */
151
152 extern double USqrt(register double d);
153 /**<
154 * <!-- double USqrt(d) -->
155 * <!-- double d; -->
156 * Return sqrt(d) with upward rounding.
157 */
158
159 extern double DExp(register double d);
160 /**<
161 * <!-- double DExp(d) -->
162 * <!-- double d; -->
163 * Return exp(d) with downward rounding.
164 */
165
166 extern double UExp(register double d);
167 /**<
168 * <!-- double UExp(d) -->
169 * <!-- double d; -->
170 * Return exp(d) with upward rounding.
171 */
172
173 extern double DLog(register double d);
174 /**<
175 * <!-- double DLog(d) -->
176 * <!-- double d; -->
177 * Return log base 10 of d rounded down.
178 */
179
180 extern double ULog(register double d);
181 /**<
182 * <!-- double ULog(d) -->
183 * <!-- double d; -->
184 * Return the log base 10 of d.
185 */
186
187 extern double DLn(register double d);
188 /**<
189 * <!-- double DLn(d) -->
190 * <!-- double d; -->
191 * Return ln(d) (log base e) with downward rounding.
192 */
193
194 extern double ULn(register double d);
195 /**<
196 * <!-- double ULn(d) -->
197 * <!-- double d; -->
198 * Return ln(d) with upward rounding.
199 */
200
201 #ifdef HAVE_ERF
202 extern double DErf(register double d);
203 /**<
204 * <!-- double DErf(d) -->
205 * <!-- double d; -->
206 * Return erf(d) with downward rounding.
207 */
208
209 extern double UErf(register double d);
210 /**<
211 * <!-- double UErf(d) -->
212 * <!-- double d; -->
213 * Return erf(d) with upward rounding.
214 */
215 #endif /* HAVE_ERF */
216
217 extern double Dltod(long int l);
218 /**<
219 * <!-- double Dltod(l) -->
220 * <!-- long l; -->
221 * Convert long to double with downward rounding.
222 */
223
224 extern double Ultod(long int l);
225 /**<
226 * <!-- double Ultod(l); -->
227 * <!-- long l -->
228 * Convert long to double with upward rounding.
229 */
230
231 #else /* SLOPPY */
232 #define Dltod(l) ((double)l)
233 #define Ultod(l) ((double)l)
234 #define DPlus(d1,d2) ((d1)+(d2))
235 #define UPlus(d1,d2) ((d1)+(d2))
236 #define DMinus(d1,d2) ((d1)-(d2))
237 #define UMinus(d1,d2) ((d1)-(d2))
238 #define DTimes(d1,d2) ((d1)*(d2))
239 #define UTimes(d1,d2) ((d1)*(d2))
240 #define DDivide(d1,d2) ((d1)/(d2))
241 #define UDivide(d1,d2) ((d1)/(d2))
242 #define DSqr(d) ((d)*(d))
243 #define USqr(d) ((d)*(d))
244 #define DSqrt(d) (sqrt(d))
245 #define USqrt(d) (sqrt(d))
246 #define DExp(d) (exp(d))
247 #define UExp(d) (exp(d))
248 #define DLn(d) (log(d))
249 #define ULn(d) (log(d))
250 #define DLog(d) (log10(d))
251 #define ULog(d) (log10(d))
252 #ifdef HAVE_ERF
253 #define DErf(d) (erf(d))
254 #define UErf(d) (erf(d))
255 #endif /* HAVE_ERF */
256 #define DPow(d1,d2) (pow(d1,d2))
257 #define UPow(d1,d2) (pow(d1,d2))
258 #endif /* SLOPPY */
259
260 /* @} */
261
262 #endif /* ASC_ROUNDED_H */
263

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22