Mercurial > forge
annotate main/fixed/src/int/fixed.cc @ 9481:d84d2fea3c90 octave-forge
Re-enable compilation of fixed package
author | jordigh |
---|---|
date | Wed, 22 Feb 2012 22:07:33 +0000 |
parents | 2de537641f94 |
children |
rev | line source |
---|---|
2383
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
2 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
3 Copyright (C) 2001-2003 Motorola Inc |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
4 Copyright (C) 2001-2003 Laurent Mazet |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
5 Copyright (C) 2003 David Bateman |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
6 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
7 This program is free software; you can redistribute it and/or modify it |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
9 Free Software Foundation; either version 2, or (at your option) any |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
10 later version. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
11 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
12 This program is distributed in the hope that it will be useful, but WITHOUT |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
15 for more details. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
16 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
4404 | 18 along with this program; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2383
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
20 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
21 In addition to the terms of the GPL, you are permitted to link |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
22 this program with any Open Source program, as defined by the |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
23 Open Source Initiative (www.opensource.org) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
24 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
25 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
26 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
27 #if !defined (__int_fixed_cc) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
28 #define __int_fixed_cc 1 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
29 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
30 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
31 #pragma implementation |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
32 #endif |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
33 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
34 #include <iostream> |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
35 #include <cmath> |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
36 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
37 #include "fixed.h" |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
38 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
39 #if !defined(OCTAVE_FORGE) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
40 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
41 #if defined(__APPLE__) && defined(__MACH__) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
42 extern "C" int isnan (double); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
43 extern "C" int isinf (double); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
44 #endif |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
45 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
46 #define lo_ieee_isnan(x) isnan(x) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
47 #define lo_ieee_isinf(x) isinf(x) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
48 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
49 #else |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
50 #include <octave/lo-ieee.h> |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
51 #endif |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
52 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
53 // Various tables of power 5. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
54 #if (SIZEOF_FIXED == 2) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
55 char pow5[16][16] = { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
56 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
57 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
58 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
59 { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
60 { 0,0,0,0,0,0,0,0,0,0,0,0,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
61 { 0,0,0,0,0,0,0,0,0,0,0,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
62 { 0,0,0,0,0,0,0,0,0,0,0,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
63 { 0,0,0,0,0,0,0,0,0,0,0,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
64 { 0,0,0,0,0,0,0,0,0,0,3,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
65 { 0,0,0,0,0,0,0,0,0,1,9,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
66 { 0,0,0,0,0,0,0,0,0,9,7,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
67 { 0,0,0,0,0,0,0,0,4,8,8,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
68 { 0,0,0,0,0,0,0,2,4,4,1,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
69 { 0,0,0,0,0,0,1,2,2,0,7,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
70 { 0,0,0,0,0,0,6,1,0,3,5,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
71 { 0,0,0,0,0,3,0,5,1,7,5,7,8,1,2,5 } }; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
72 #elif (SIZEOF_FIXED == 4) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
73 char pow5[32][32] = { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
74 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
75 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
76 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
77 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
78 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
79 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
80 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
81 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
82 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
83 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,9,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
84 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,7,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
85 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,8,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
86 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,4,1,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
87 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,0,7,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
88 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,1,0,3,5,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
89 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,5,1,7,5,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
90 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,2,5,8,7,8,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
91 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,6,2,9,3,9,4,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
92 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,8,1,4,6,9,7,2,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
93 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,9,0,7,3,4,8,6,3,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
94 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,5,3,6,7,4,3,1,6,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
95 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,6,8,3,7,1,5,8,2,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
96 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,8,4,1,8,5,7,9,1,0,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
97 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,2,0,9,2,8,9,5,5,0,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
98 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,9,6,0,4,6,4,4,7,7,5,3,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
99 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,9,8,0,2,3,2,2,3,8,7,6,9,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
100 { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,9,0,1,1,6,1,1,9,3,8,4,7,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
101 { 0,0,0,0,0,0,0,0,0,0,0,0,0,7,4,5,0,5,8,0,5,9,6,9,2,3,8,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
102 { 0,0,0,0,0,0,0,0,0,0,0,0,3,7,2,5,2,9,0,2,9,8,4,6,1,9,1,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
103 { 0,0,0,0,0,0,0,0,0,0,0,1,8,6,2,6,4,5,1,4,9,2,3,0,9,5,7,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
104 { 0,0,0,0,0,0,0,0,0,0,0,9,3,1,3,2,2,5,7,4,6,1,5,4,7,8,5,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
105 { 0,0,0,0,0,0,0,0,0,0,4,6,5,6,6,1,2,8,7,3,0,7,7,3,9,2,5,7,8,1,2,5 } }; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
106 #elif (SIZEOF_FIXED == 8) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
107 char pow5[64][64] = { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
108 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
109 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
110 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
111 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
112 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
113 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
114 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
115 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
116 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
117 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,9,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
118 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,7,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
119 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,8,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
120 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,4,1,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
121 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,0,7,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
122 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,1,0,3,5,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
123 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,5,1,7,5,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
124 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,2,5,8,7,8,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
125 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,6,2,9,3,9,4,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
126 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,8,1,4,6,9,7,2,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
127 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,9,0,7,3,4,8,6,3,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
128 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,5,3,6,7,4,3,1,6,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
129 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,6,8,3,7,1,5,8,2,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
130 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,8,4,1,8,5,7,9,1,0,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
131 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,2,0,9,2,8,9,5,5,0,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
132 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,9,6,0,4,6,4,4,7,7,5,3,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
133 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,9,8,0,2,3,2,2,3,8,7,6,9,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
134 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,9,0,1,1,6,1,1,9,3,8,4,7,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
135 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,4,5,0,5,8,0,5,9,6,9,2,3,8,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
136 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,2,5,2,9,0,2,9,8,4,6,1,9,1,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
137 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,8,6,2,6,4,5,1,4,9,2,3,0,9,5,7,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
138 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,3,1,3,2,2,5,7,4,6,1,5,4,7,8,5,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
139 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,6,5,6,6,1,2,8,7,3,0,7,7,3,9,2,5,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
140 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,2,8,3,0,6,4,3,6,5,3,8,6,9,6,2,8,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
141 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,6,4,1,5,3,2,1,8,2,6,9,3,4,8,1,4,4,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
142 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,8,2,0,7,6,6,0,9,1,3,4,6,7,4,0,7,2,2,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
143 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,9,1,0,3,8,3,0,4,5,6,7,3,3,7,0,3,6,1,3,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
144 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,5,5,1,9,1,5,2,2,8,3,6,6,8,5,1,8,0,6,6,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
145 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,2,7,5,9,5,7,6,1,4,1,8,3,4,2,5,9,0,3,3,2,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
146 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,3,7,9,7,8,8,0,7,0,9,1,7,1,2,9,5,1,6,6,0,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
147 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,8,1,8,9,8,9,4,0,3,5,4,5,8,5,6,4,7,5,8,3,0,0,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
148 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,9,4,9,4,7,0,1,7,7,2,9,2,8,2,3,7,9,1,5,0,3,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
149 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,4,7,4,7,3,5,0,8,8,6,4,6,4,1,1,8,9,5,7,5,1,9,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
150 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,7,3,7,3,6,7,5,4,4,3,2,3,2,0,5,9,4,7,8,7,5,9,7,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
151 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,3,6,8,6,8,3,7,7,2,1,6,1,6,0,2,9,7,3,9,3,7,9,8,8,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
152 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,6,8,4,3,4,1,8,8,6,0,8,0,8,0,1,4,8,6,9,6,8,9,9,4,1,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
153 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,8,4,2,1,7,0,9,4,3,0,4,0,4,0,0,7,4,3,4,8,4,4,9,7,0,7,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
154 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,2,1,0,8,5,4,7,1,5,2,0,2,0,0,3,7,1,7,4,2,2,4,8,5,3,5,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
155 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,1,0,5,4,2,7,3,5,7,6,0,1,0,0,1,8,5,8,7,1,1,2,4,2,6,7,5,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
156 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,5,5,2,7,1,3,6,7,8,8,0,0,5,0,0,9,2,9,3,5,5,6,2,1,3,3,7,8,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
157 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,6,3,5,6,8,3,9,4,0,0,2,5,0,4,6,4,6,7,7,8,1,0,6,6,8,9,4,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
158 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,1,7,8,4,1,9,7,0,0,1,2,5,2,3,2,3,3,8,9,0,5,3,3,4,4,7,2,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
159 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,0,8,9,2,0,9,8,5,0,0,6,2,6,1,6,1,6,9,4,5,2,6,6,7,2,3,6,3,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
160 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,4,4,6,0,4,9,2,5,0,3,1,3,0,8,0,8,4,7,2,6,3,3,3,6,1,8,1,6,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
161 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,2,2,3,0,2,4,6,2,5,1,5,6,5,4,0,4,2,3,6,3,1,6,6,8,0,9,0,8,2,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
162 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,1,1,1,5,1,2,3,1,2,5,7,8,2,7,0,2,1,1,8,1,5,8,3,4,0,4,5,4,1,0,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
163 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,5,5,5,7,5,6,1,5,6,2,8,9,1,3,5,1,0,5,9,0,7,9,1,7,0,2,2,7,0,5,0,7,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
164 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,8,7,7,7,8,7,8,0,7,8,1,4,4,5,6,7,5,5,2,9,5,3,9,5,8,5,1,1,3,5,2,5,3,9,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
165 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,9,3,8,8,9,3,9,0,3,9,0,7,2,2,8,3,7,7,6,4,7,6,9,7,9,2,5,5,6,7,6,2,6,9,5,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
166 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,6,9,4,4,6,9,5,1,9,5,3,6,1,4,1,8,8,8,2,3,8,4,8,9,6,2,7,8,3,8,1,3,4,7,6,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
167 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,3,4,7,2,3,4,7,5,9,7,6,8,0,7,0,9,4,4,1,1,9,2,4,4,8,1,3,9,1,9,0,6,7,3,8,2,8,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
168 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,7,3,6,1,7,3,7,9,8,8,4,0,3,5,4,7,2,0,5,9,6,2,2,4,0,6,9,5,9,5,3,3,6,9,1,4,0,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
169 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,3,3,6,8,0,8,6,8,9,9,4,2,0,1,7,7,3,6,0,2,9,8,1,1,2,0,3,4,7,9,7,6,6,8,4,5,7,0,3,1,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
170 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,6,8,4,0,4,3,4,4,9,7,1,0,0,8,8,6,8,0,1,4,9,0,5,6,0,1,7,3,9,8,8,3,4,2,2,8,5,1,5,6,2,5 }, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
171 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,8,4,2,0,2,1,7,2,4,8,5,5,0,4,4,3,4,0,0,7,4,5,2,8,0,0,8,6,9,9,4,1,7,1,1,4,2,5,7,8,1,2,5 } }; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
172 #else |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
173 # error ("Tables of power 5 only availble for fp_uint sizes of 4 and 8 bytes"); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
174 #endif |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
175 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
176 const fp_uint one = 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
177 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
178 #if !defined(OCTAVE_FORGE) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
179 void Fixed::_error (char *file, int line, Fixed::Code code) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
180 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
181 std::cerr << "Error in file " << file |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
182 << " at line " << line << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
183 std::cerr << message[code] << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
184 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
185 exit (1); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
186 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
187 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
188 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
189 void Fixed::_warning (char *file, int line, Fixed::Code code) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
190 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
191 std::cerr << "Warning in file " << file |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
192 << " at line " << line << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
193 std::cerr << message[code] << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
194 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
195 #endif |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
196 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
197 /* FixedPoint de-structuror */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
198 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
199 double FixedPoint::fixedpoint() const { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
200 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
201 double v = (signbit()) ? -(double)((-number)&filter) : (double)number; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
202 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
203 v /= (1<<decsize); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
204 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
205 return (v); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
206 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
207 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
208 /* FixedPoint constructors */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
209 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
210 FixedPoint::FixedPoint (unsigned int is, unsigned int ds, const fp_uint n) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
211 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
212 /* This constructor helps to construct FixedPoint from the `number' |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
213 field of an FixedPoing object. As the sign bit is not marked, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
214 this constructor can overflow. */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
215 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
216 /* Check sizes */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
217 if (ds+is > maxfixedsize) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
218 { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
219 fixed_error (Fixed::WRONGFIXSIZE); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
220 return; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
221 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
222 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
223 /* Get sizes */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
224 decsize = ds; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
225 intsize = is; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
226 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
227 /* Get filters */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
228 filter = (one << (is+ds+1)) - 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
229 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
230 /* Build number */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
231 number = n&filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
232 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
233 /* Check for overflow */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
234 if ((Fixed::FP_Overflow) && (n > filter)) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
235 fixed_warning (Fixed::LOSS_MSB_INT); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
236 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
237 /* Debug */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
238 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
239 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
240 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
241 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
242 FixedPoint::FixedPoint (unsigned int is, unsigned int ds, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
243 const fp_uint i, const fp_uint d) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
244 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
245 /* This constructor helps to construct FixedPoint from an (i,d) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
246 representation. As the sign bit is not marked, this constructor |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
247 can overflow from integer part and decimal part. */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
248 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
249 /* Check sizes */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
250 if (ds+is > maxfixedsize) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
251 { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
252 fixed_error (Fixed::WRONGFIXSIZE); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
253 return; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
254 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
255 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
256 /* Get sizes */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
257 decsize = ds; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
258 intsize = is; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
259 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
260 /* Get filters */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
261 filter = (one << (is+ds+1)) - 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
262 fp_uint filter_int = (one << (is+1)) - 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
263 fp_uint filter_dec = (one << ds) - 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
264 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
265 /* Build number */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
266 number = ((i&filter_int) << ds) | (d&filter_dec); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
267 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
268 /* Check for overflow */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
269 if (Fixed::FP_Overflow) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
270 if (d > filter_dec) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
271 fixed_warning (Fixed::LOSS_MSB_DEC); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
272 if (i > filter_int) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
273 fixed_warning (Fixed::LOSS_MSB_INT); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
274 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
275 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
276 /* Debug */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
277 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
278 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
279 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
280 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
281 FixedPoint::FixedPoint (unsigned int is, unsigned int ds, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
282 const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
283 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
284 /* This constructor helps to construct FixedPoint from a other |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
285 FixedPoint object. Even if this constructor loss some bits from |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
286 integer part, the sign bit is kept. */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
287 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
288 /* Check sizes */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
289 if (ds+is> maxfixedsize) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
290 { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
291 fixed_error (Fixed::WRONGFIXSIZE); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
292 return; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
293 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
294 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
295 /* Get sizes */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
296 decsize = ds; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
297 intsize = is; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
298 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
299 /* Get sign bit */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
300 fp_uint s = x.signbit(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
301 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
302 /* Get filter */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
303 filter = (one << (is+ds+1)) - 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
304 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
305 /* Create decimal part */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
306 int diffds = ds-x.decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
307 fp_uint d = x.number & ((one << x.decsize)-1); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
308 d = (diffds > 0) ? ( d << diffds) : (d >> (-diffds)); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
309 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
310 /* Create integer part */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
311 int diffis = is-x.intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
312 fp_uint i = (x.number >> x.decsize) & ((one << x.intsize)-1); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
313 if ((s) && (diffis > 0)) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
314 i |= ((one << diffis)-1) << x.intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
315 i &= (one << is)-1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
316 i |= (s << is); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
317 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
318 /* Create number */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
319 number = (i << ds) | d; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
320 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
321 /* Check for overflow */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
322 if (Fixed::FP_Overflow) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
323 if (s) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
324 if ((diffis < 0) && |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
325 ((x.number >> x.decsize) < ((one << (1-diffis))-1) << is)) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
326 fixed_warning(Fixed::LOSS_MSB_FP); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
327 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
328 else { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
329 if ((x.number >> x.decsize) >= (one << is)) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
330 fixed_warning(Fixed::LOSS_MSB_FP); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
331 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
332 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
333 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
334 /* Debug */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
335 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
336 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
337 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
338 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
339 FixedPoint::FixedPoint (unsigned int is, unsigned int ds, double x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
340 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
341 /* This constructor helps to construct FixedPoint from a double |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
342 precision number. This constructor act as a ADC and clip too |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
343 large value*/ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
344 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
345 /* Check sizes */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
346 if (ds+is > maxfixedsize) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
347 fixed_error (Fixed::WRONGFIXSIZE); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
348 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
349 /* Get sizes */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
350 decsize = ds; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
351 intsize = is; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
352 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
353 /* Get filter */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
354 filter = (one << (is+ds+1)) - 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
355 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
356 /* Create clipping values */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
357 double negclip = - double(one<<is); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
358 double posclip = double(one<<is) - 1./(one<<ds); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
359 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
360 /* Check for erreur */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
361 if (lo_ieee_isnan(x)) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
362 /* Not a number */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
363 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
364 x = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
365 if (Fixed::FP_Overflow) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
366 fixed_warning(Fixed::NAN_CONST); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
367 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
368 } else if (lo_ieee_isinf(x)) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
369 /* Infinity */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
370 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
371 x = (lo_ieee_isinf(x) > 0) ? posclip : negclip; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
372 if (Fixed::FP_Overflow) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
373 fixed_warning(Fixed::INF_CONST); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
374 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
375 } else if (x > posclip) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
376 /* Positive clipping */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
377 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
378 x = posclip; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
379 if (Fixed::FP_Overflow) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
380 fixed_warning(Fixed::LOSS_MSB_DB); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
381 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
382 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
383 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
384 else if (x < negclip) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
385 /* Negative clipping */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
386 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
387 x = negclip; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
388 if (Fixed::FP_Overflow) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
389 fixed_warning(Fixed::LOSS_MSB_DB); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
390 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
391 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
392 /* Create number */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
393 if (x == negclip) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
394 number = one<<(is+ds); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
395 else { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
396 number = (fp_uint) floor(x*(1<<ds)); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
397 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
398 number &= filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
399 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
400 /* Debug */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
401 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
402 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
403 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
404 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
405 FixedPoint::FixedPoint (const fp_int x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
406 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
407 /* This constructor helps to construct FixedPoint from a |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
408 integer. This constructor act as a ADC and clip too large |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
409 value. */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
410 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
411 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
412 fp_int x_clipped; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
413 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
414 /* Create clipping values */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
415 fp_int negclip = - fp_int(one<<maxfixedsize); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
416 fp_int posclip = fp_int(one<<maxfixedsize) - 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
417 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
418 /* Check for erreur */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
419 if (x > posclip) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
420 /* Positive clipping */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
421 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
422 x_clipped = posclip; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
423 if (Fixed::FP_Overflow) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
424 fixed_warning(Fixed::LOSS_MSB_DB); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
425 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
426 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
427 else if (x < negclip) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
428 /* Negative clipping */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
429 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
430 x_clipped = negclip; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
431 if (Fixed::FP_Overflow) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
432 fixed_warning(Fixed::LOSS_MSB_DB); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
433 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
434 else |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
435 x_clipped = x; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
436 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
437 /* Get sizes */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
438 decsize = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
439 intsize = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
440 fp_int tmp = x_clipped; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
441 while ((tmp) && (~tmp)) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
442 intsize++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
443 tmp>>=1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
444 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
445 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
446 /* Get filter */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
447 filter = (one << (intsize+1)) - 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
448 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
449 /* Create number */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
450 number = x_clipped & filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
451 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
452 /* Debug */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
453 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
454 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
455 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
456 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
457 /* This is a stupid constructor, that drops the decimal part, but it |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
458 at least allows the C++ complex class to do log10 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
459 FixedPoint::FixedPoint (const double y) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
460 *this = FixedPoint(fp_int(y)); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
461 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
462 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
463 /* FixedPoint intern operators */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
464 FixedPoint &FixedPoint::operator = (const fp_int &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
465 FixedPoint y(x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
466 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
467 intsize = y.intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
468 decsize = y.decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
469 filter = y.filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
470 number = y.number; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
471 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
472 value = y.value; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
473 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
474 return (*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
475 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
476 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
477 FixedPoint &FixedPoint::operator = (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
478 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
479 intsize = x.intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
480 decsize = x.decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
481 filter = x.filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
482 number = x.number; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
483 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
484 value = x.value; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
485 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
486 return (*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
487 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
488 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
489 FixedPoint &FixedPoint::operator += (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
490 FixedPoint n; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
491 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
492 if ((x.intsize != intsize) || (x.decsize != decsize)) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
493 int _intsize = (x.intsize > intsize) ? x.intsize : intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
494 int _decsize = (x.decsize > decsize) ? x.decsize : decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
495 *this = FixedPoint(_intsize, _decsize, *this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
496 n = FixedPoint(_intsize, _decsize, x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
497 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
498 else |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
499 n = x; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
500 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
501 char s = Fixed::FP_Overflow ? signbit() : 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
502 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
503 number += n.number; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
504 if ((Fixed::FP_Overflow) && (s == n.signbit()) && |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
505 ((s?((~number)&filter):number)>>(intsize+decsize))) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
506 fixed_warning(Fixed::LOSS_MSB_ADD); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
507 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
508 number &= filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
509 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
510 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
511 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
512 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
513 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
514 Fixed::FP_Operations.nb_add++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
515 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
516 return (*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
517 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
518 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
519 FixedPoint &FixedPoint::operator -= (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
520 FixedPoint n; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
521 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
522 if ((x.intsize != intsize) || (x.decsize != decsize)) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
523 int _intsize = (x.intsize > intsize) ? x.intsize : intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
524 int _decsize = (x.decsize > decsize) ? x.decsize : decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
525 *this = FixedPoint(_intsize, _decsize, *this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
526 n = FixedPoint(_intsize, _decsize, x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
527 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
528 else |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
529 n = x; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
530 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
531 char s = Fixed::FP_Overflow ? signbit() : 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
532 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
533 number -= n.number; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
534 if ((Fixed::FP_Overflow) && (s != n.signbit()) && |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
535 ((s?((~number)&filter):number)>>(intsize+decsize))) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
536 fixed_warning(Fixed::LOSS_MSB_SUB); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
537 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
538 number &= filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
539 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
540 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
541 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
542 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
543 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
544 Fixed::FP_Operations.nb_sub++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
545 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
546 return (*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
547 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
548 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
549 FixedPoint &FixedPoint::operator *= (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
550 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
551 /* To avoid any problem of multiplication overflow, we limit |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
552 the maximum number space to maxfixedsize */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
553 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
554 FixedPoint n; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
555 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
556 if ((x.intsize != intsize) || (x.decsize != decsize)) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
557 int _intsize = (x.intsize > intsize) ? x.intsize : intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
558 int _decsize = (x.decsize > decsize) ? x.decsize : decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
559 *this = FixedPoint(_intsize, _decsize, *this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
560 n = FixedPoint(_intsize, _decsize, x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
561 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
562 else |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
563 n = x; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
564 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
565 fp_uint n1 = (signbit()) ? (-number)&filter : number; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
566 fp_uint n2 = (n.signbit()) ? (-n.number)&filter : n.number; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
567 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
568 if (intsize+decsize < halffixedsize) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
569 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
570 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
571 No overflow problem. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
572 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
573 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
574 n1 *= n2; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
575 n1 >>= decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
576 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
577 if ((Fixed::FP_Overflow) && |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
578 (!((signbit() != n.signbit()) && |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
579 (fp_int(n1) == (1L<<(intsize+decsize))))) && |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
580 (n1>>(intsize+decsize))) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
581 fixed_warning(Fixed::LOSS_MSB_MULT); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
582 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
583 number = ((signbit() != n.signbit()) ? -n1 : n1)&filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
584 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
585 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
586 else { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
587 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
588 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
589 Overflow problem. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
590 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
591 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
592 int size = intsize+decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
593 int unconsistent_bits = size - halffixedsize + 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
594 fp_int lsb_filter = (1<<unconsistent_bits)-1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
595 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
596 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
597 Split n1 and n2 into two part. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
598 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
599 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
600 fp_uint n1_high = n1>>unconsistent_bits; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
601 fp_uint n1_low = n1&lsb_filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
602 fp_uint n2_high = n2>>unconsistent_bits; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
603 fp_uint n2_low = n2&lsb_filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
604 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
605 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
606 Calculate the lowest part of n1*n2. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
607 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
608 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
609 fp_uint n_low = n1_low*n2_low; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
610 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
611 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
612 Calculate the medium part of n1*n2 and extract |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
613 the msb part of the lowest part to avoid bit |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
614 redundancy. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
615 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
616 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
617 fp_uint n_medium = n1_high*n2_low + n1_low*n2_high + |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
618 (n_low>>unconsistent_bits); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
619 n_low &= lsb_filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
620 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
621 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
622 Calculate the highest part of n1*n2 and extract |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
623 the msb part of the medium part to avoid bit |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
624 redundancy. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
625 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
626 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
627 fp_uint n_high = n1_high*n2_high + (n_medium>>unconsistent_bits); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
628 n_medium &= lsb_filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
629 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
630 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
631 Keep only bits in fixed point format from the |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
632 lowest part of the product. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
633 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
634 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
635 fp_uint n_sized = n_low >> decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
636 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
637 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
638 Keep only bits in fixed point format from the |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
639 medium part of the product and put them at right |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
640 position. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
641 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
642 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
643 if (int(decsize) > unconsistent_bits) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
644 n_sized += n_medium>>(decsize-unconsistent_bits); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
645 else |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
646 n_sized += n_medium<<(unconsistent_bits-decsize); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
647 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
648 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
649 Keep only bits in fixed point format from the |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
650 highest part of the product and put them at right |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
651 position |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
652 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
653 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
654 if (int(decsize) > 2*unconsistent_bits) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
655 n_sized += n_high >>(decsize-2*unconsistent_bits); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
656 else |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
657 n_sized += n_high <<(2*unconsistent_bits-decsize); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
658 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
659 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
660 Check format and sign bit. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
661 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
662 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
663 if (Fixed::FP_Overflow) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
664 int _t = 2*unconsistent_bits-decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
665 if ((!((signbit() != n.signbit()) && |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
666 (fp_int(n_sized) == (1L<<(intsize+decsize))))) && |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
667 (((_t >= 0) && (((n_high<<_t)>>_t) != n_high)) || |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
668 (n_sized>>(intsize+decsize)))) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
669 fixed_warning(Fixed::LOSS_MSB_MULT); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
670 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
671 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
672 number = ((signbit() != n.signbit()) ? -n_sized : n_sized)&filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
673 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
674 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
675 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
676 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
677 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
678 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
679 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
680 Fixed::FP_Operations.nb_mult++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
681 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
682 return (*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
683 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
684 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
685 FixedPoint &FixedPoint::operator /= (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
686 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
687 /* This operator need to really be implemented in a fixed precision |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
688 manner */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
689 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
690 double y1 = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
691 double y2 = x.fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
692 *this = FixedPoint((x.intsize > intsize) ? x.intsize : intsize, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
693 (x.decsize > decsize) ? x.decsize : decsize, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
694 y1/y2); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
695 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
696 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
697 Fixed::FP_Operations.nb_div++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
698 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
699 return (*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
700 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
701 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
702 FixedPoint &FixedPoint::operator <<= (const int s) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
703 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
704 if ((Fixed::FP_Overflow) && |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
705 (((intsize+decsize-s>0) &&(number)) || |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
706 (((signbit()?((~number)&filter):number)>>(intsize+decsize-s))))) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
707 fixed_warning(Fixed::LOSS_MSB_LSHIFT); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
708 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
709 number <<= s; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
710 number &= filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
711 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
712 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
713 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
714 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
715 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
716 Fixed::FP_Operations.nb_lshift++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
717 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
718 return (*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
719 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
720 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
721 FixedPoint &FixedPoint::operator >>= (const int s) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
722 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
723 char sign = signbit(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
724 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
725 number >>= s; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
726 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
727 if (sign) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
728 number |= (filter >> s) ^ filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
729 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
730 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
731 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
732 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
733 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
734 Fixed::FP_Operations.nb_rshift++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
735 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
736 return (*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
737 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
738 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
739 /* FixedPoint unary operators */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
740 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
741 FixedPoint &FixedPoint::operator ++ () { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
742 // prefix ++ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
743 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
744 char s = Fixed::FP_Overflow ? signbit() : 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
745 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
746 number++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
747 if ((Fixed::FP_Overflow) && (!s) && (signbit())) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
748 fixed_warning(Fixed::LOSS_MSB_PRE_INC); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
749 number &= filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
750 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
751 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
752 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
753 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
754 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
755 Fixed::FP_Operations.nb_inc++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
756 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
757 return(*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
758 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
759 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
760 FixedPoint &FixedPoint::operator -- () { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
761 // prefix -- |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
762 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
763 char s = Fixed::FP_Overflow ? signbit() : 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
764 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
765 number--; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
766 if ((Fixed::FP_Overflow) && (s) && (!signbit())) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
767 fixed_warning(Fixed::LOSS_MSB_PRE_DEC); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
768 number &= filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
769 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
770 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
771 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
772 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
773 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
774 Fixed::FP_Operations.nb_dec++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
775 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
776 return(*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
777 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
778 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
779 FixedPoint FixedPoint::operator ++ (int) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
780 // postfix ++ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
781 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
782 FixedPoint n(*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
783 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
784 char s = Fixed::FP_Overflow ? signbit() : 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
785 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
786 number++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
787 if ((Fixed::FP_Overflow) && (!s) && (signbit())) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
788 fixed_warning(Fixed::LOSS_MSB_POST_INC); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
789 number &= filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
790 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
791 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
792 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
793 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
794 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
795 Fixed::FP_Operations.nb_inc++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
796 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
797 return (n); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
798 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
799 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
800 FixedPoint FixedPoint::operator -- (int) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
801 // postfix -- |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
802 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
803 FixedPoint n(*this); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
804 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
805 char s = Fixed::FP_Overflow ? signbit() : 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
806 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
807 number--; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
808 if ((Fixed::FP_Overflow) && (s) && (!signbit())) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
809 fixed_warning(Fixed::LOSS_MSB_PRE_DEC); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
810 number &= filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
811 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
812 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
813 value = fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
814 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
815 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
816 Fixed::FP_Operations.nb_dec++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
817 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
818 return (n); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
819 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
820 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
821 FixedPoint operator - (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
822 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
823 FixedPoint n(x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
824 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
825 n.number = (-n.number) & n.filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
826 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
827 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
828 n.value = n.fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
829 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
830 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
831 Fixed::FP_Operations.nb_neg++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
832 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
833 return (n); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
834 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
835 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
836 FixedPoint operator ! (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
837 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
838 FixedPoint n(x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
839 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
840 n.number = n.number & (n.filter >> 1); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
841 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
842 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
843 n.value = n.fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
844 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
845 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
846 Fixed::FP_Operations.nb_comp++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
847 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
848 return (n); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
849 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
850 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
851 /* FixedPoint comparators */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
852 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
853 bool operator == (const FixedPoint &x, const FixedPoint &y) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
854 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
855 if ((x.decsize == y.decsize) && (x.intsize == y.intsize)) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
856 return (x.number == y.number); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
857 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
858 unsigned int dsmax = (x.decsize > y.decsize) ? x.decsize : y.decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
859 unsigned int ismax = (x.intsize > y.intsize) ? x.intsize : y.intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
860 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
861 FixedPoint x1(ismax, dsmax, x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
862 FixedPoint y1(ismax, dsmax, y); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
863 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
864 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
865 Fixed::FP_Operations.nb_eq++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
866 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
867 return (x1.number == y1.number); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
868 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
869 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
870 bool operator != (const FixedPoint &x, const FixedPoint &y) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
871 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
872 if ((x.decsize == y.decsize) && (x.intsize == y.intsize)) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
873 return (x.number != y.number); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
874 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
875 unsigned int dsmax = (x.decsize > y.decsize) ? x.decsize : y.decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
876 unsigned int ismax = (x.intsize > y.intsize) ? x.intsize : y.intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
877 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
878 FixedPoint x1(ismax, dsmax, x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
879 FixedPoint y1(ismax, dsmax, y); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
880 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
881 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
882 Fixed::FP_Operations.nb_neq++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
883 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
884 return (x1.number != y1.number); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
885 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
886 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
887 bool operator > (const FixedPoint &x, const FixedPoint &y) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
888 FixedPoint x1, y1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
889 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
890 if ((x.decsize != y.decsize) || (x.intsize != y.intsize)) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
891 unsigned int dsmax = (x.decsize > y.decsize) ? x.decsize : y.decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
892 unsigned int ismax = (x.intsize > y.intsize) ? x.intsize : y.intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
893 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
894 x1 = FixedPoint(ismax, dsmax, x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
895 y1 = FixedPoint(ismax, dsmax, y); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
896 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
897 else { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
898 x1 = x; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
899 y1 = y; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
900 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
901 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
902 char x1_sign = x1.signbit(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
903 char y1_sign = y1.signbit(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
904 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
905 if (x1_sign == y1_sign) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
906 return (x1.number > y1.number); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
907 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
908 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
909 Fixed::FP_Operations.nb_gt++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
910 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
911 return (x1_sign == 0); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
912 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
913 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
914 bool operator >= (const FixedPoint &x, const FixedPoint &y) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
915 FixedPoint x1, y1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
916 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
917 if ((x.decsize != y.decsize) || (x.intsize != y.intsize)) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
918 unsigned int dsmax = (x.decsize > y.decsize) ? x.decsize : y.decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
919 unsigned int ismax = (x.intsize > y.intsize) ? x.intsize : y.intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
920 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
921 x1 = FixedPoint(ismax, dsmax, x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
922 y1 = FixedPoint(ismax, dsmax, y); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
923 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
924 else { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
925 x1 = x; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
926 y1 = y; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
927 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
928 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
929 char x1_sign = x1.signbit(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
930 char y1_sign = y1.signbit(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
931 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
932 if (x1_sign == y1_sign) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
933 return (x1.number >= y1.number); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
934 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
935 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
936 Fixed::FP_Operations.nb_ge++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
937 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
938 return (x1_sign == 0); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
939 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
940 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
941 bool operator < (const FixedPoint &x, const FixedPoint &y) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
942 FixedPoint x1, y1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
943 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
944 if ((x.decsize != y.decsize) || (x.intsize != y.intsize)) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
945 unsigned int dsmax = (x.decsize > y.decsize) ? x.decsize : y.decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
946 unsigned int ismax = (x.intsize > y.intsize) ? x.intsize : y.intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
947 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
948 x1 = FixedPoint(ismax, dsmax, x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
949 y1 = FixedPoint(ismax, dsmax, y); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
950 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
951 else { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
952 x1 = x; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
953 y1 = y; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
954 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
955 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
956 char x1_sign = x1.signbit(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
957 char y1_sign = y1.signbit(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
958 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
959 if (x1_sign == y1_sign) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
960 return (x1.number < y1.number); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
961 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
962 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
963 Fixed::FP_Operations.nb_lt++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
964 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
965 return (x1_sign != 0); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
966 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
967 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
968 bool operator <= (const FixedPoint &x, const FixedPoint &y) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
969 FixedPoint x1, y1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
970 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
971 if ((x.decsize != y.decsize) || (x.intsize != y.intsize)) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
972 unsigned int dsmax = (x.decsize > y.decsize) ? x.decsize : y.decsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
973 unsigned int ismax = (x.intsize > y.intsize) ? x.intsize : y.intsize; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
974 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
975 x1 = FixedPoint(ismax, dsmax, x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
976 y1 = FixedPoint(ismax, dsmax, y); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
977 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
978 else { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
979 x1 = x; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
980 y1 = y; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
981 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
982 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
983 char x1_sign = x1.signbit(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
984 char y1_sign = y1.signbit(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
985 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
986 if (x1_sign == y1_sign) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
987 return (x1.number <= y1.number); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
988 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
989 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
990 Fixed::FP_Operations.nb_le++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
991 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
992 return (x1_sign != 0); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
993 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
994 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
995 /* FixedPoint shifting functions */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
996 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
997 FixedPoint rshift(const FixedPoint &x, int s) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
998 FixedPoint t(x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
999 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1000 while (s--) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1001 t.decsize++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1002 if (t.intsize) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1003 t.intsize--; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1004 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1005 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1006 if (t.decsize+t.intsize > maxfixedsize) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1007 fixed_error (Fixed::WRONGFIXSIZE); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1008 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1009 return t; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1010 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1011 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1012 FixedPoint lshift(const FixedPoint &x, int s) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1013 FixedPoint t(x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1014 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1015 while (s--) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1016 t.intsize++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1017 if (t.decsize) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1018 t.decsize--; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1019 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1020 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1021 if (t.decsize+t.intsize > maxfixedsize) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1022 fixed_error (Fixed::WRONGFIXSIZE); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1023 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1024 return t; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1025 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1026 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1027 /* These are to simplify things for Octave */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1028 FixedPoint real (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1029 return x; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1030 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1031 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1032 FixedPoint imag (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1033 return FixedPoint(x.intsize, x.decsize); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1034 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1035 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1036 FixedPoint conj (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1037 return x; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1038 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1039 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1040 /* FixedPoint mathematic functions */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1041 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1042 FixedPoint abs (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1043 if (x.signbit()) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1044 FixedPoint t(x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1045 t.number = (-x.number)&x.filter; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1046 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1047 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1048 t.value = -x.value; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1049 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1050 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1051 Fixed::FP_Operations.nb_neg++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1052 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1053 return (t); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1054 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1055 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1056 return (x); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1057 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1058 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1059 #define FRIEND_FIXEDPOINT_MFUNC(FUNC) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1060 FixedPoint FUNC (const FixedPoint &x) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1061 { \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1062 if (Fixed::FP_CountOperations) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1063 Fixed::FP_Operations.nb_##FUNC++; \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1064 return (FixedPoint(x.intsize, x.decsize, FUNC(x.fixedpoint()))); \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1065 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1066 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1067 #define FRIEND_FIXEDPOINT_MFUNC_LOWER(FUNC, lower) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1068 FixedPoint FUNC (const FixedPoint &x) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1069 { \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1070 double value = x.fixedpoint(); \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1071 if (value < lower) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1072 { fixed_error (Fixed::BADMATH); return FixedPoint(); } \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1073 if (Fixed::FP_CountOperations) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1074 Fixed::FP_Operations.nb_##FUNC++; \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1075 return FixedPoint(x.intsize, x.decsize, FUNC(value)); \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1076 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1077 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1078 #define FRIEND_FIXEDPOINT_MFUNC_UPPER(FUNC, upper) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1079 FixedPoint FUNC (const FixedPoint &x) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1080 { \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1081 double value = x.fixedpoint(); \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1082 if (value > upper) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1083 { fixed_error (Fixed::BADMATH); return FixedPoint(); } \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1084 if (Fixed::FP_CountOperations) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1085 Fixed::FP_Operations.nb_##FUNC++; \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1086 return FixedPoint(x.intsize, x.decsize, FUNC(value)); \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1087 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1088 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1089 #define FRIEND_FIXEDPOINT_MFUNC_RANGE(FUNC, upper, lower) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1090 FixedPoint FUNC (const FixedPoint &x) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1091 { \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1092 double value = x.fixedpoint(); \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1093 if ((value < lower) || (value > upper)) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1094 { fixed_error (Fixed::BADMATH); return FixedPoint(); } \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1095 if (Fixed::FP_CountOperations) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1096 Fixed::FP_Operations.nb_##FUNC++; \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1097 return FixedPoint(x.intsize, x.decsize, FUNC(value)); \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1098 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1099 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1100 FRIEND_FIXEDPOINT_MFUNC (cos); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1101 FRIEND_FIXEDPOINT_MFUNC (cosh); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1102 FRIEND_FIXEDPOINT_MFUNC (sin); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1103 FRIEND_FIXEDPOINT_MFUNC (sinh); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1104 FRIEND_FIXEDPOINT_MFUNC (tan); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1105 FRIEND_FIXEDPOINT_MFUNC (tanh); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1106 FRIEND_FIXEDPOINT_MFUNC_LOWER (sqrt,0.); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1107 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1108 #define FRIEND_FIXEDPOINT_POW(TYPE) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1109 FixedPoint pow (const FixedPoint &x, const TYPE y) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1110 { \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1111 if (Fixed::FP_CountOperations) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1112 Fixed::FP_Operations.nb_pow++; \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1113 return (FixedPoint(x.intsize, x.decsize, std::pow(x.fixedpoint(), y))); \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1114 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1115 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1116 FRIEND_FIXEDPOINT_POW (int); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1117 FRIEND_FIXEDPOINT_POW (double); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1118 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1119 FixedPoint pow (const FixedPoint &x, const FixedPoint &y) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1120 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1121 if (Fixed::FP_CountOperations) \ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1122 Fixed::FP_Operations.nb_pow++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1123 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1124 return (FixedPoint(x.intsize, x.decsize, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1125 pow(x.fixedpoint(), y.fixedpoint()))); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1126 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1127 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1128 FRIEND_FIXEDPOINT_MFUNC (exp); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1129 FRIEND_FIXEDPOINT_MFUNC_LOWER (log,0.); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1130 FRIEND_FIXEDPOINT_MFUNC_LOWER (log10,0.); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1131 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1132 FixedPoint atan2 (const FixedPoint &x, const FixedPoint &y) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1133 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1134 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1135 Fixed::FP_Operations.nb_atan2++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1136 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1137 return (FixedPoint(x.intsize, x.decsize, |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1138 atan2(x.fixedpoint(), y.fixedpoint()))); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1139 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1140 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1141 FixedPoint round (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1142 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1143 if (Fixed::FP_CountOperations) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1144 Fixed::FP_Operations.nb_round++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1145 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1146 return (FixedPoint(x.intsize, x.decsize, floor(x.fixedpoint() + 0.5))); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1147 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1148 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1149 FRIEND_FIXEDPOINT_MFUNC (rint); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1150 FRIEND_FIXEDPOINT_MFUNC (floor); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1151 FRIEND_FIXEDPOINT_MFUNC (ceil); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1152 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1153 std::istream &operator >> (std::istream &is, FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1154 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1155 double d; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1156 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1157 is >> d; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1158 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1159 FixedPoint z(x.intsize, x.decsize, d); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1160 x.number = z.number; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1161 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1162 if (Fixed::FP_Debug) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1163 x.value = x.fixedpoint(); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1164 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1165 return (is); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1166 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1167 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1168 std::ostream &operator << (std::ostream &os, const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1169 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1170 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1171 Extract number without sign. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1172 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1173 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1174 fp_uint num = (x.signbit()) ? (-x.number)&x.filter : x.number; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1175 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1176 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1177 Extract integer and decimal part. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1178 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1179 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1180 fp_uint i = num >> x.decsize; |
9481 | 1181 fp_uint d = (num & ((x.filter >> (x.intsize+1)) & x.filter)); |
2383
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1182 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1183 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1184 Print sign. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1185 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1186 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1187 if (x.signbit()) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1188 os << "-"; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1189 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1190 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1191 Print integer part. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1192 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1193 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1194 os << i; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1195 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1196 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1197 Process decimal part. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1198 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1199 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1200 if (x.decsize) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1201 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1202 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1203 Print decimal dot. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1204 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1205 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1206 os << "."; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1207 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1208 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1209 Table of 5 power from 0 to bit number of "fp_uint" |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1210 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1211 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1212 const int nb_digits = SIZEOF_FIXED * 8; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1213 const int nb_digits_1 = nb_digits-1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1214 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1215 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1216 Create decimal part as a string and compute its length. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1217 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1218 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1219 char dec[nb_digits]; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1220 int dec_len = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1221 while (d > 0) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1222 dec[nb_digits_1-dec_len] = d%10; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1223 dec_len++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1224 d /= 10; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1225 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1226 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1227 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1228 Create and initialize result string. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1229 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1230 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1231 char res[nb_digits]; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1232 for (int k=0; k<nb_digits; k++) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1233 res[k] = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1234 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1235 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1236 Multiply 5^x.decsize by decimal part. |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1237 */ |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1238 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1239 for (int k=0; k<nb_digits; k++) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1240 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1241 int val = pow5[x.decsize][nb_digits_1-k]; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1242 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1243 for (int l=0; l<dec_len; l++) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1244 int digit = l + k; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1245 int tmp = (res[nb_digits_1-digit]) + (dec[nb_digits_1-l])*val; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1246 while (tmp > 0) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1247 res[nb_digits_1-digit] = (tmp%10); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1248 digit++; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1249 tmp /= 10; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1250 tmp += (res[nb_digits_1-digit]); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1251 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1252 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1253 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1254 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1255 for (int k=nb_digits-x.decsize; k<nb_digits;k++) |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1256 os << char(res[k]+'0'); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1257 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1258 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1259 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1260 return (os); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1261 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1262 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1263 std::string getbitstring (const FixedPoint &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1264 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1265 int l = x.intsize+x.decsize+1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1266 fp_uint nb = x.number; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1267 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1268 std::string st(l, ' '); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1269 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1270 for (int i=1; i<=l; i++) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1271 st[l-i] = '0'+ (nb&1); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1272 nb >>= 1; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1273 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1274 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1275 return (st); |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1276 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1277 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1278 // FixedPoint operation summary |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1279 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1280 FixedPointOperation::FixedPointOperation() : |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1281 nb_add(0), nb_sub(0), nb_mult(0), nb_div(0), |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1282 nb_lshift(0), nb_rshift(0), |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1283 nb_inc(0), nb_dec(0), |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1284 nb_neg(0), nb_comp(0), |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1285 nb_eq(0), nb_neq(0), nb_gt(0), nb_ge(0), nb_lt(0), nb_le(0), |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1286 nb_cos(0), nb_cosh(0), nb_sin(0), nb_sinh(0), nb_tan(0), nb_tanh(0), |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1287 nb_sqrt(0), nb_pow(0), nb_exp(0), nb_log(0), nb_log10(0), |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1288 nb_atan2(0), |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1289 nb_round(0), nb_rint(0), nb_floor(0), nb_ceil(0) {} |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1290 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1291 void FixedPointOperation::reset () { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1292 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1293 nb_add = nb_sub = nb_mult = nb_div = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1294 nb_lshift = nb_rshift = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1295 nb_inc = nb_dec = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1296 nb_neg = nb_comp = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1297 nb_eq = nb_neq = nb_gt = nb_ge = nb_lt = nb_le = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1298 nb_cos = nb_cosh = nb_sin = nb_sinh = nb_tan = nb_tanh = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1299 nb_sqrt = nb_pow = nb_exp = nb_log = nb_log10 = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1300 nb_atan2 = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1301 nb_round = nb_rint = nb_floor = nb_ceil = 0; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1302 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1303 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1304 std::ostream &operator << (std::ostream &os, const FixedPointOperation &x) { |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1305 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1306 os << "Summary of FixedPoint operations" << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1307 os << "================================" << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1308 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1309 os << "Number of additions: " << x.nb_add << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1310 os << "Number of subtractions: " << x.nb_sub << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1311 os << "Number of multiplications: " << x.nb_mult << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1312 os << "Number of divisions: " << x.nb_div << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1313 os << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1314 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1315 os << "Number of left shifts: " << x.nb_lshift << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1316 os << "Number of right shifts: " << x.nb_rshift << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1317 os << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1318 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1319 os << "Number of increments: " << x.nb_inc << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1320 os << "Number of decrements: " << x.nb_dec << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1321 os << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1322 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1323 os << "Number of negations: " << x.nb_neg << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1324 os << "Number of bitwise not: " << x.nb_comp << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1325 os << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1326 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1327 os << "Number of equalities: " << x.nb_eq << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1328 os << "Number of inequalities: " << x.nb_neq << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1329 os << "Number of greater than: " << x.nb_gt << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1330 os << "Number of greater than or equal to: " << x.nb_ge << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1331 os << "Number of less than: " << x.nb_lt << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1332 os << "Number of less than or equal to: " << x.nb_le << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1333 os << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1334 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1335 os << "Number of cosine calculations: " << x.nb_cos << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1336 os << "Number of hyperbolic cosine calculations: " << x.nb_cosh << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1337 os << "Number of sine calculations: " << x.nb_sin << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1338 os << "Number of hyperbolic sine calculations: " << x.nb_sinh << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1339 os << "Number of tangent calculations: " << x.nb_tan << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1340 os << "Number of hyperbolic tangent calculations: " << x.nb_tanh << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1341 os << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1342 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1343 os << "Number of square roots: " << x.nb_sqrt << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1344 os << "Number of power calculations: " << x.nb_pow << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1345 os << "Number of exponentials: " << x.nb_exp << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1346 os << "Number of logarithms: " << x.nb_log << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1347 os << "Number of base 10 logarithms: " << x.nb_log10 << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1348 os << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1349 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1350 os << "Number of arc-tangent calculations: " << x.nb_atan2 << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1351 os << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1352 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1353 os << "Number of round operations: " << x.nb_round << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1354 os << "Number of rint operations: " << x.nb_rint << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1355 os << "Number of floor operations: " << x.nb_floor << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1356 os << "Number of ceil operations: " << x.nb_ceil << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1357 os << std::endl; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1358 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1359 return os; |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1360 } |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1361 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1362 #endif |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1363 |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1364 /* |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1365 ;;; Local Variables: *** |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1366 ;;; mode: C++ *** |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1367 ;;; End: *** |
d1930f8af7ca
Changed the directory structure of fixed to match the package system
hauberg
parents:
diff
changeset
|
1368 */ |