Commit 8a43d8ec873005c4d21011b88ac9ca7d83f73584
1 parent
bfb563e1
Exists in
master
cc
Showing
6 changed files
with
39 additions
and
12 deletions
Show diff stats
.idea/Numerical.iml
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <module type="PYTHON_MODULE" version="4"> | 2 | <module type="PYTHON_MODULE" version="4"> |
3 | <component name="NewModuleRootManager"> | 3 | <component name="NewModuleRootManager"> |
4 | <content url="file://$MODULE_DIR$" /> | 4 | <content url="file://$MODULE_DIR$" /> |
5 | - <orderEntry type="jdk" jdkName="Python 2.7.6 virtualenv at ~/.virtualenvs/env0" jdkType="Python SDK" /> | 5 | + <orderEntry type="jdk" jdkName="Python 2.7.8 virtualenv at ~/.virtualenvs/env0" jdkType="Python SDK" /> |
6 | <orderEntry type="sourceFolder" forTests="false" /> | 6 | <orderEntry type="sourceFolder" forTests="false" /> |
7 | </component> | 7 | </component> |
8 | </module> | 8 | </module> |
9 | \ No newline at end of file | 9 | \ No newline at end of file |
.idea/misc.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <project version="4"> | 2 | <project version="4"> |
3 | + <component name="DaemonCodeAnalyzer"> | ||
4 | + <disable_hints /> | ||
5 | + </component> | ||
6 | + <component name="DependencyValidationManager"> | ||
7 | + <option name="SKIP_IMPORT_STATEMENTS" value="false" /> | ||
8 | + </component> | ||
9 | + <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> | ||
3 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> | 10 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> |
4 | <OptionsSetting value="true" id="Add" /> | 11 | <OptionsSetting value="true" id="Add" /> |
5 | <OptionsSetting value="true" id="Remove" /> | 12 | <OptionsSetting value="true" id="Remove" /> |
@@ -10,5 +17,11 @@ | @@ -10,5 +17,11 @@ | ||
10 | <ConfirmationsSetting value="0" id="Add" /> | 17 | <ConfirmationsSetting value="0" id="Add" /> |
11 | <ConfirmationsSetting value="0" id="Remove" /> | 18 | <ConfirmationsSetting value="0" id="Remove" /> |
12 | </component> | 19 | </component> |
13 | - <component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.6 (/usr/bin/python2.7)" project-jdk-type="Python SDK" /> | 20 | + <component name="ProjectModuleManager"> |
21 | + <modules /> | ||
22 | + </component> | ||
23 | + <component name="ProjectRootManager" version="2" project-jdk-name="Python 2.6.6 (/usr/bin/python)" project-jdk-type="Python SDK" /> | ||
24 | + <component name="RunManager"> | ||
25 | + <list size="0" /> | ||
26 | + </component> | ||
14 | </project> | 27 | </project> |
15 | \ No newline at end of file | 28 | \ No newline at end of file |
.idea/workspace.xml
@@ -11,8 +11,8 @@ | @@ -11,8 +11,8 @@ | ||
11 | <component name="CreatePatchCommitExecutor"> | 11 | <component name="CreatePatchCommitExecutor"> |
12 | <option name="PATCH_PATH" value="" /> | 12 | <option name="PATCH_PATH" value="" /> |
13 | </component> | 13 | </component> |
14 | - <component name="NamedScopeManager"> | ||
15 | - <order /> | 14 | + <component name="DaemonCodeAnalyzer"> |
15 | + <disable_hints /> | ||
16 | </component> | 16 | </component> |
17 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> | 17 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> |
18 | <OptionsSetting value="true" id="Add" /> | 18 | <OptionsSetting value="true" id="Add" /> |
@@ -24,18 +24,24 @@ | @@ -24,18 +24,24 @@ | ||
24 | <ConfirmationsSetting value="0" id="Add" /> | 24 | <ConfirmationsSetting value="0" id="Add" /> |
25 | <ConfirmationsSetting value="0" id="Remove" /> | 25 | <ConfirmationsSetting value="0" id="Remove" /> |
26 | </component> | 26 | </component> |
27 | + <component name="RunManager"> | ||
28 | + <list size="0" /> | ||
29 | + </component> | ||
27 | <component name="ShelveChangesManager" show_recycled="false" /> | 30 | <component name="ShelveChangesManager" show_recycled="false" /> |
28 | <component name="TaskManager"> | 31 | <component name="TaskManager"> |
29 | <task active="true" id="Default" summary="Default task"> | 32 | <task active="true" id="Default" summary="Default task"> |
30 | - <created>1434792298659</created> | ||
31 | <option name="number" value="Default" /> | 33 | <option name="number" value="Default" /> |
32 | - <updated>1434792298659</updated> | ||
33 | </task> | 34 | </task> |
34 | <servers /> | 35 | <servers /> |
35 | </component> | 36 | </component> |
36 | <component name="VcsContentAnnotationSettings"> | 37 | <component name="VcsContentAnnotationSettings"> |
37 | <option name="myLimit" value="2678400000" /> | 38 | <option name="myLimit" value="2678400000" /> |
38 | </component> | 39 | </component> |
40 | + <component name="VcsManagerConfiguration"> | ||
41 | + <option name="myTodoPanelSettings"> | ||
42 | + <TodoPanelSettings /> | ||
43 | + </option> | ||
44 | + </component> | ||
39 | <component name="XDebuggerManager"> | 45 | <component name="XDebuggerManager"> |
40 | <breakpoint-manager /> | 46 | <breakpoint-manager /> |
41 | <watches-manager /> | 47 | <watches-manager /> |
chap1/1_3_infiniteseries.py
1 | __author__ = 'chunk' | 1 | __author__ = 'chunk' |
2 | 2 | ||
3 | import struct | 3 | import struct |
4 | - | 4 | +import numpy as np |
5 | 5 | ||
6 | def float2bits(f, fmt='bin'): | 6 | def float2bits(f, fmt='bin'): |
7 | if fmt == 'hex': | 7 | if fmt == 'hex': |
@@ -30,14 +30,13 @@ def double2bin(num): | @@ -30,14 +30,13 @@ def double2bin(num): | ||
30 | 30 | ||
31 | 31 | ||
32 | def infiniteseries(): | 32 | def infiniteseries(): |
33 | - s = 0 | ||
34 | - tmp = -1 | 33 | + s = np.float32(0) |
34 | + tmp = np.float32(-1) | ||
35 | i = 0 | 35 | i = 0 |
36 | - while float(s) != float(tmp): | 36 | + while s != tmp: |
37 | i += 1 | 37 | i += 1 |
38 | tmp = s | 38 | tmp = s |
39 | - s += float(1.0 / i) | ||
40 | - print tmp,s | 39 | + s += np.float32(1.0 / i) |
41 | 40 | ||
42 | print i, s, tmp | 41 | print i, s, tmp |
43 | 42 |