@@ -0,0 +1,127 | |||
|
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
|
No newline at end of file | ||
|
2 | <?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> | |
|
No newline at end of file | ||
|
3 | <storageModule moduleId="org.eclipse.cdt.core.settings"> | |
|
No newline at end of file | ||
|
4 | <cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.726614945"> | |
|
No newline at end of file | ||
|
5 | <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.726614945" moduleId="org.eclipse.cdt.core.settings" name="Debug"> | |
|
No newline at end of file | ||
|
6 | <externalSettings/> | |
|
No newline at end of file | ||
|
7 | <extensions> | |
|
No newline at end of file | ||
|
8 | <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> | |
|
No newline at end of file | ||
|
9 | <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
No newline at end of file | ||
|
10 | <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
No newline at end of file | ||
|
11 | <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
No newline at end of file | ||
|
12 | <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
No newline at end of file | ||
|
13 | <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
No newline at end of file | ||
|
14 | </extensions> | |
|
No newline at end of file | ||
|
15 | </storageModule> | |
|
No newline at end of file | ||
|
16 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |
|
No newline at end of file | ||
|
17 | <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.726614945" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug"> | |
|
No newline at end of file | ||
|
18 | <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.726614945." name="/" resourcePath=""> | |
|
No newline at end of file | ||
|
19 | <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1187435907" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug"> | |
|
No newline at end of file | ||
|
20 | <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.588259323" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/> | |
|
No newline at end of file | ||
|
21 | <builder buildPath="${workspace_loc:/fixpoint}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.142867279" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/> | |
|
No newline at end of file | ||
|
22 | <tool id="cdt.managedbuild.tool.gnu.archiver.base.1340458624" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> | |
|
No newline at end of file | ||
|
23 | <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1123809143" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug"> | |
|
No newline at end of file | ||
|
24 | <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1352962247" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> | |
|
No newline at end of file | ||
|
25 | <option id="gnu.cpp.compiler.exe.debug.option.debugging.level.602612294" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> | |
|
No newline at end of file | ||
|
26 | <option id="gnu.cpp.compiler.option.dialect.std.2006213990" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/> | |
|
No newline at end of file | ||
|
27 | <option id="gnu.cpp.compiler.option.other.other.377703301" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0" valueType="string"/> | |
|
No newline at end of file | ||
|
28 | <option id="gnu.cpp.compiler.option.other.verbose.88007056" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" value="false" valueType="boolean"/> | |
|
No newline at end of file | ||
|
29 | <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1358658388" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> | |
|
No newline at end of file | ||
|
30 | </tool> | |
|
No newline at end of file | ||
|
31 | <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.2093971068" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug"> | |
|
No newline at end of file | ||
|
32 | <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1595578750" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/> | |
|
No newline at end of file | ||
|
33 | <option id="gnu.c.compiler.exe.debug.option.debugging.level.1789087258" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> | |
|
No newline at end of file | ||
|
34 | <option id="gnu.c.compiler.option.misc.other.1606297075" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 " valueType="string"/> | |
|
No newline at end of file | ||
|
35 | <option id="gnu.c.compiler.option.misc.verbose.1010982186" name="Verbose (-v)" superClass="gnu.c.compiler.option.misc.verbose" value="false" valueType="boolean"/> | |
|
No newline at end of file | ||
|
36 | <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1171595764" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> | |
|
No newline at end of file | ||
|
37 | </tool> | |
|
No newline at end of file | ||
|
38 | <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.2034761377" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/> | |
|
No newline at end of file | ||
|
39 | <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1694084085" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug"> | |
|
No newline at end of file | ||
|
40 | <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1839555914" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> | |
|
No newline at end of file | ||
|
41 | <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> | |
|
No newline at end of file | ||
|
42 | <additionalInput kind="additionalinput" paths="$(LIBS)"/> | |
|
No newline at end of file | ||
|
43 | </inputType> | |
|
No newline at end of file | ||
|
44 | </tool> | |
|
No newline at end of file | ||
|
45 | <tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.49081962" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug"> | |
|
No newline at end of file | ||
|
46 | <inputType id="cdt.managedbuild.tool.gnu.assembler.input.953234959" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> | |
|
No newline at end of file | ||
|
47 | </tool> | |
|
No newline at end of file | ||
|
48 | </toolChain> | |
|
No newline at end of file | ||
|
49 | </folderInfo> | |
|
No newline at end of file | ||
|
50 | </configuration> | |
|
No newline at end of file | ||
|
51 | </storageModule> | |
|
No newline at end of file | ||
|
52 | <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | |
|
No newline at end of file | ||
|
53 | </cconfiguration> | |
|
No newline at end of file | ||
|
54 | <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.627789590"> | |
|
No newline at end of file | ||
|
55 | <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.627789590" moduleId="org.eclipse.cdt.core.settings" name="Release"> | |
|
No newline at end of file | ||
|
56 | <externalSettings/> | |
|
No newline at end of file | ||
|
57 | <extensions> | |
|
No newline at end of file | ||
|
58 | <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> | |
|
No newline at end of file | ||
|
59 | <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
No newline at end of file | ||
|
60 | <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
No newline at end of file | ||
|
61 | <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
No newline at end of file | ||
|
62 | <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
No newline at end of file | ||
|
63 | <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
No newline at end of file | ||
|
64 | </extensions> | |
|
No newline at end of file | ||
|
65 | </storageModule> | |
|
No newline at end of file | ||
|
66 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |
|
No newline at end of file | ||
|
67 | <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.627789590" name="Release" parent="cdt.managedbuild.config.gnu.exe.release"> | |
|
No newline at end of file | ||
|
68 | <folderInfo id="cdt.managedbuild.config.gnu.exe.release.627789590." name="/" resourcePath=""> | |
|
No newline at end of file | ||
|
69 | <toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.203535649" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release"> | |
|
No newline at end of file | ||
|
70 | <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1705051134" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/> | |
|
No newline at end of file | ||
|
71 | <builder buildPath="${workspace_loc:/fixpoint}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.968018891" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/> | |
|
No newline at end of file | ||
|
72 | <tool id="cdt.managedbuild.tool.gnu.archiver.base.1233091539" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> | |
|
No newline at end of file | ||
|
73 | <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.217129682" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release"> | |
|
No newline at end of file | ||
|
74 | <option id="gnu.cpp.compiler.exe.release.option.optimization.level.853294042" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/> | |
|
No newline at end of file | ||
|
75 | <option id="gnu.cpp.compiler.exe.release.option.debugging.level.819444220" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> | |
|
No newline at end of file | ||
|
76 | <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.323758775" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> | |
|
No newline at end of file | ||
|
77 | </tool> | |
|
No newline at end of file | ||
|
78 | <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1379716" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"> | |
|
No newline at end of file | ||
|
79 | <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.1394624330" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/> | |
|
No newline at end of file | ||
|
80 | <option id="gnu.c.compiler.exe.release.option.debugging.level.630382415" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/> | |
|
No newline at end of file | ||
|
81 | <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.45831321" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> | |
|
No newline at end of file | ||
|
82 | </tool> | |
|
No newline at end of file | ||
|
83 | <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1178554217" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/> | |
|
No newline at end of file | ||
|
84 | <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.541725393" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"> | |
|
No newline at end of file | ||
|
85 | <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1118856248" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> | |
|
No newline at end of file | ||
|
86 | <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> | |
|
No newline at end of file | ||
|
87 | <additionalInput kind="additionalinput" paths="$(LIBS)"/> | |
|
No newline at end of file | ||
|
88 | </inputType> | |
|
No newline at end of file | ||
|
89 | </tool> | |
|
No newline at end of file | ||
|
90 | <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.486187560" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"> | |
|
No newline at end of file | ||
|
91 | <inputType id="cdt.managedbuild.tool.gnu.assembler.input.610155476" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> | |
|
No newline at end of file | ||
|
92 | </tool> | |
|
No newline at end of file | ||
|
93 | </toolChain> | |
|
No newline at end of file | ||
|
94 | </folderInfo> | |
|
No newline at end of file | ||
|
95 | </configuration> | |
|
No newline at end of file | ||
|
96 | </storageModule> | |
|
No newline at end of file | ||
|
97 | <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | |
|
No newline at end of file | ||
|
98 | </cconfiguration> | |
|
No newline at end of file | ||
|
99 | </storageModule> | |
|
No newline at end of file | ||
|
100 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |
|
No newline at end of file | ||
|
101 | <project id="fixpoint.cdt.managedbuild.target.gnu.exe.1493244722" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/> | |
|
No newline at end of file | ||
|
102 | </storageModule> | |
|
No newline at end of file | ||
|
103 | <storageModule moduleId="scannerConfiguration"> | |
|
No newline at end of file | ||
|
104 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |
|
No newline at end of file | ||
|
105 | <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.726614945;cdt.managedbuild.config.gnu.exe.debug.726614945.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1123809143;cdt.managedbuild.tool.gnu.cpp.compiler.input.1358658388"> | |
|
No newline at end of file | ||
|
106 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |
|
No newline at end of file | ||
|
107 | </scannerConfigBuildInfo> | |
|
No newline at end of file | ||
|
108 | <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.627789590;cdt.managedbuild.config.gnu.exe.release.627789590.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1379716;cdt.managedbuild.tool.gnu.c.compiler.input.45831321"> | |
|
No newline at end of file | ||
|
109 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |
|
No newline at end of file | ||
|
110 | </scannerConfigBuildInfo> | |
|
No newline at end of file | ||
|
111 | <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.627789590;cdt.managedbuild.config.gnu.exe.release.627789590.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.217129682;cdt.managedbuild.tool.gnu.cpp.compiler.input.323758775"> | |
|
No newline at end of file | ||
|
112 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |
|
No newline at end of file | ||
|
113 | </scannerConfigBuildInfo> | |
|
No newline at end of file | ||
|
114 | <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.726614945;cdt.managedbuild.config.gnu.exe.debug.726614945.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.2093971068;cdt.managedbuild.tool.gnu.c.compiler.input.1171595764"> | |
|
No newline at end of file | ||
|
115 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |
|
No newline at end of file | ||
|
116 | </scannerConfigBuildInfo> | |
|
No newline at end of file | ||
|
117 | </storageModule> | |
|
No newline at end of file | ||
|
118 | <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> | |
|
No newline at end of file | ||
|
119 | <storageModule moduleId="refreshScope" versionNumber="2"> | |
|
No newline at end of file | ||
|
120 | <configuration configurationName="Debug"> | |
|
No newline at end of file | ||
|
121 | <resource resourceType="PROJECT" workspacePath="/fixpoint"/> | |
|
No newline at end of file | ||
|
122 | </configuration> | |
|
No newline at end of file | ||
|
123 | <configuration configurationName="Release"> | |
|
No newline at end of file | ||
|
124 | <resource resourceType="PROJECT" workspacePath="/fixpoint"/> | |
|
No newline at end of file | ||
|
125 | </configuration> | |
|
No newline at end of file | ||
|
126 | </storageModule> | |
|
No newline at end of file | ||
|
127 | </cproject> No newline at end of file |
@@ -0,0 +1,27 | |||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
|
No newline at end of file | ||
|
2 | <projectDescription> | |
|
No newline at end of file | ||
|
3 | <name>fixpoint</name> | |
|
No newline at end of file | ||
|
4 | <comment></comment> | |
|
No newline at end of file | ||
|
5 | <projects> | |
|
No newline at end of file | ||
|
6 | </projects> | |
|
No newline at end of file | ||
|
7 | <buildSpec> | |
|
No newline at end of file | ||
|
8 | <buildCommand> | |
|
No newline at end of file | ||
|
9 | <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> | |
|
No newline at end of file | ||
|
10 | <triggers>clean,full,incremental,</triggers> | |
|
No newline at end of file | ||
|
11 | <arguments> | |
|
No newline at end of file | ||
|
12 | </arguments> | |
|
No newline at end of file | ||
|
13 | </buildCommand> | |
|
No newline at end of file | ||
|
14 | <buildCommand> | |
|
No newline at end of file | ||
|
15 | <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> | |
|
No newline at end of file | ||
|
16 | <triggers>full,incremental,</triggers> | |
|
No newline at end of file | ||
|
17 | <arguments> | |
|
No newline at end of file | ||
|
18 | </arguments> | |
|
No newline at end of file | ||
|
19 | </buildCommand> | |
|
No newline at end of file | ||
|
20 | </buildSpec> | |
|
No newline at end of file | ||
|
21 | <natures> | |
|
No newline at end of file | ||
|
22 | <nature>org.eclipse.cdt.core.cnature</nature> | |
|
No newline at end of file | ||
|
23 | <nature>org.eclipse.cdt.core.ccnature</nature> | |
|
No newline at end of file | ||
|
24 | <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> | |
|
No newline at end of file | ||
|
25 | <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> | |
|
No newline at end of file | ||
|
26 | </natures> | |
|
No newline at end of file | ||
|
27 | </projectDescription> No newline at end of file |
@@ -0,0 +1,121 | |||
|
1 | /* | |
|
No newline at end of file | ||
|
2 | * fixpoint<T>.h | |
|
No newline at end of file | ||
|
3 | * | |
|
No newline at end of file | ||
|
4 | * Created on: Feb 24, 2015 | |
|
No newline at end of file | ||
|
5 | * Author: aras | |
|
No newline at end of file | ||
|
6 | */ | |
|
No newline at end of file | ||
|
7 | ||
|
No newline at end of file | ||
|
8 | #ifndef FIXPOINT_H_ | |
|
No newline at end of file | ||
|
9 | #define FIXPOINT_H_ | |
|
No newline at end of file | ||
|
10 | ||
|
No newline at end of file | ||
|
11 | #include <inttypes.h> | |
|
No newline at end of file | ||
|
12 | #include <math.h> | |
|
No newline at end of file | ||
|
13 | #include <typeinfo> | |
|
No newline at end of file | ||
|
14 | #include <cstdio> | |
|
No newline at end of file | ||
|
15 | ||
|
No newline at end of file | ||
|
16 | ||
|
No newline at end of file | ||
|
17 | ||
|
No newline at end of file | ||
|
18 | ||
|
No newline at end of file | ||
|
19 | template<class T> | |
|
No newline at end of file | ||
|
20 | class fixpoint { | |
|
No newline at end of file | ||
|
21 | ||
|
No newline at end of file | ||
|
22 | private: | |
|
No newline at end of file | ||
|
23 | uint8_t factor; | |
|
No newline at end of file | ||
|
24 | T value; | |
|
No newline at end of file | ||
|
25 | ||
|
No newline at end of file | ||
|
26 | public: | |
|
No newline at end of file | ||
|
27 | fixpoint<T>(const fixpoint<T>& fp){factor=fp.factor;value=fp.value;}; | |
|
No newline at end of file | ||
|
28 | fixpoint<T>(uint8_t dec); | |
|
No newline at end of file | ||
|
29 | fixpoint<T>(uint8_t dec,T num); | |
|
No newline at end of file | ||
|
30 | ||
|
No newline at end of file | ||
|
31 | void set_from_float(float num){value=T(num*(1<<factor));} | |
|
No newline at end of file | ||
|
32 | void set(T val){value = val;} | |
|
No newline at end of file | ||
|
33 | float tofloat(); | |
|
No newline at end of file | ||
|
34 | ||
|
No newline at end of file | ||
|
35 | ||
|
No newline at end of file | ||
|
36 | friend inline fixpoint<T> operator-(const fixpoint<T> &num1, const fixpoint<T> &num2){ | |
|
No newline at end of file | ||
|
37 | return fixpoint<T>(num1.factor,num1.value-num2.value); | |
|
No newline at end of file | ||
|
38 | } | |
|
No newline at end of file | ||
|
39 | friend inline fixpoint<T> operator+(const fixpoint<T> &num1, const fixpoint<T> &num2){ | |
|
No newline at end of file | ||
|
40 | return fixpoint<T>(num1.factor,num1.value+num2.value); | |
|
No newline at end of file | ||
|
41 | } | |
|
No newline at end of file | ||
|
42 | friend inline fixpoint<T> operator*(const fixpoint<T> &num1, const fixpoint<T> &num2){ | |
|
No newline at end of file | ||
|
43 | int64_t aux = (int64_t(num1.value)*int64_t(num2.value))>>num1.factor; | |
|
No newline at end of file | ||
|
44 | return fixpoint<T>(num1.factor,T(aux)); | |
|
No newline at end of file | ||
|
45 | } | |
|
No newline at end of file | ||
|
46 | friend inline fixpoint<T> operator/(const fixpoint<T> &num1, const fixpoint<T> &num2){ | |
|
No newline at end of file | ||
|
47 | int64_t aux = (int64_t(num1.value)<<num1.factor); | |
|
No newline at end of file | ||
|
48 | return fixpoint<T>(num1.factor,aux/num2.value); | |
|
No newline at end of file | ||
|
49 | } | |
|
No newline at end of file | ||
|
50 | ||
|
No newline at end of file | ||
|
51 | ||
|
No newline at end of file | ||
|
52 | //fixpoint<T>& operator= ( const fixpoint<T>& ); | |
|
No newline at end of file | ||
|
53 | ||
|
No newline at end of file | ||
|
54 | inline fixpoint<T> power(); | |
|
No newline at end of file | ||
|
55 | inline fixpoint<T> sqroot(); | |
|
No newline at end of file | ||
|
56 | }; | |
|
No newline at end of file | ||
|
57 | ||
|
No newline at end of file | ||
|
58 | ||
|
No newline at end of file | ||
|
59 | //template<class T> | |
|
No newline at end of file | ||
|
60 | //fixpoint<T> & fixpoint<T>::operator= ( fixpoint<T> ){ | |
|
No newline at end of file | ||
|
61 | // | |
|
No newline at end of file | ||
|
62 | //} | |
|
No newline at end of file | ||
|
63 | ||
|
No newline at end of file | ||
|
64 | ||
|
No newline at end of file | ||
|
65 | ||
|
No newline at end of file | ||
|
66 | ||
|
No newline at end of file | ||
|
67 | template<class T> | |
|
No newline at end of file | ||
|
68 | fixpoint<T>::fixpoint(uint8_t dec){ | |
|
No newline at end of file | ||
|
69 | factor=dec; | |
|
No newline at end of file | ||
|
70 | value=0; | |
|
No newline at end of file | ||
|
71 | } | |
|
No newline at end of file | ||
|
72 | ||
|
No newline at end of file | ||
|
73 | template<class T> | |
|
No newline at end of file | ||
|
74 | fixpoint<T>::fixpoint(uint8_t dec,T num){ | |
|
No newline at end of file | ||
|
75 | factor=dec; | |
|
No newline at end of file | ||
|
76 | value=num; | |
|
No newline at end of file | ||
|
77 | } | |
|
No newline at end of file | ||
|
78 | ||
|
No newline at end of file | ||
|
79 | ||
|
No newline at end of file | ||
|
80 | template<class T> | |
|
No newline at end of file | ||
|
81 | float fixpoint<T>::tofloat(){ | |
|
No newline at end of file | ||
|
82 | return float(value)/(1<<factor); | |
|
No newline at end of file | ||
|
83 | } | |
|
No newline at end of file | ||
|
84 | ||
|
No newline at end of file | ||
|
85 | template<class T> | |
|
No newline at end of file | ||
|
86 | fixpoint<T> fixpoint<T>::power(){ | |
|
No newline at end of file | ||
|
87 | int64_t aux = (int64_t(value)*int64_t(value))>>factor; | |
|
No newline at end of file | ||
|
88 | return fixpoint<T>(aux); | |
|
No newline at end of file | ||
|
89 | } | |
|
No newline at end of file | ||
|
90 | ||
|
No newline at end of file | ||
|
91 | template<class T> | |
|
No newline at end of file | ||
|
92 | fixpoint<T> fixpoint<T>::sqroot(){ | |
|
No newline at end of file | ||
|
93 | T aux = sqrt(value); | |
|
No newline at end of file | ||
|
94 | return fixpoint<T>(aux<<(factor/2)); | |
|
No newline at end of file | ||
|
95 | } | |
|
No newline at end of file | ||
|
96 | ||
|
No newline at end of file | ||
|
97 | ||
|
No newline at end of file | ||
|
98 | ||
|
No newline at end of file | ||
|
99 | typedef fixpoint<int32_t> num32; | |
|
No newline at end of file | ||
|
100 | typedef fixpoint<int64_t> num64; | |
|
No newline at end of file | ||
|
101 | ||
|
No newline at end of file | ||
|
102 | ||
|
No newline at end of file | ||
|
103 | class fix1912:public num32{ | |
|
No newline at end of file | ||
|
104 | public: | |
|
No newline at end of file | ||
|
105 | fix1912():num32(12){}; | |
|
No newline at end of file | ||
|
106 | fix1912(int32_t num):num32(12,num){}; | |
|
No newline at end of file | ||
|
107 | }; | |
|
No newline at end of file | ||
|
108 | ||
|
No newline at end of file | ||
|
109 | class fix0922:public num32{ | |
|
No newline at end of file | ||
|
110 | public: | |
|
No newline at end of file | ||
|
111 | fix0922():num32(22){}; | |
|
No newline at end of file | ||
|
112 | fix0922(int32_t num):num32(22,num){}; | |
|
No newline at end of file | ||
|
113 | }; | |
|
No newline at end of file | ||
|
114 | ||
|
No newline at end of file | ||
|
115 | class fix4320:public num64{ | |
|
No newline at end of file | ||
|
116 | public: | |
|
No newline at end of file | ||
|
117 | fix4320():num64(20){}; | |
|
No newline at end of file | ||
|
118 | fix4320(int64_t num):num64(20,num){}; | |
|
No newline at end of file | ||
|
119 | }; | |
|
No newline at end of file | ||
|
120 | ||
|
No newline at end of file | ||
|
121 | #endif /* FIXPOINT_H_ */ No newline at end of file |
@@ -0,0 +1,31 | |||
|
1 | /* | |
|
No newline at end of file | ||
|
2 | * fixpoint_test.cpp | |
|
No newline at end of file | ||
|
3 | * | |
|
No newline at end of file | ||
|
4 | * Created on: Feb 24, 2015 | |
|
No newline at end of file | ||
|
5 | * Author: aras | |
|
No newline at end of file | ||
|
6 | */ | |
|
No newline at end of file | ||
|
7 | ||
|
No newline at end of file | ||
|
8 | #include "fixpoint.h" | |
|
No newline at end of file | ||
|
9 | ||
|
No newline at end of file | ||
|
10 | ||
|
No newline at end of file | ||
|
11 | int main(){ | |
|
No newline at end of file | ||
|
12 | ||
|
No newline at end of file | ||
|
13 | fix1912 A; | |
|
No newline at end of file | ||
|
14 | fix1912 B; | |
|
No newline at end of file | ||
|
15 | A.set_from_float(2); | |
|
No newline at end of file | ||
|
16 | B.set_from_float(5); | |
|
No newline at end of file | ||
|
17 | fix1912 C; | |
|
No newline at end of file | ||
|
18 | C=A*B; | |
|
No newline at end of file | ||
|
19 | C.power(); | |
|
No newline at end of file | ||
|
20 | // N44_20 A1; | |
|
No newline at end of file | ||
|
21 | // N44_20 B1; | |
|
No newline at end of file | ||
|
22 | // A1.set_from_float(2); | |
|
No newline at end of file | ||
|
23 | // B1.set_from_float(5); | |
|
No newline at end of file | ||
|
24 | // | |
|
No newline at end of file | ||
|
25 | // N44_20 C1 = (A1*B1).power(); | |
|
No newline at end of file | ||
|
26 | ||
|
No newline at end of file | ||
|
27 | printf("float valout: %f\n",-2.0*500.0); | |
|
No newline at end of file | ||
|
28 | printf("C valout: %f\n",C.tofloat()); | |
|
No newline at end of file | ||
|
29 | // printf("C1 valout: %f",C1.tofloat()); | |
|
No newline at end of file | ||
|
30 | return 0; | |
|
No newline at end of file | ||
|
31 | } No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now