Commit 8a43d8ec873005c4d21011b88ac9ca7d83f73584

Authored by Chunk
1 parent bfb563e1
Exists in master

cc

.idea/Numerical.iml
... ... @@ -2,7 +2,7 @@
2 2 <module type="PYTHON_MODULE" version="4">
3 3 <component name="NewModuleRootManager">
4 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 6 <orderEntry type="sourceFolder" forTests="false" />
7 7 </component>
8 8 </module>
9 9 \ No newline at end of file
... ...
.idea/encodings.xml 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
  4 +</project>
0 5 \ No newline at end of file
... ...
.idea/misc.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 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 10 <component name="ProjectLevelVcsManager" settingsEditedManually="false">
4 11 <OptionsSetting value="true" id="Add" />
5 12 <OptionsSetting value="true" id="Remove" />
... ... @@ -10,5 +17,11 @@
10 17 <ConfirmationsSetting value="0" id="Add" />
11 18 <ConfirmationsSetting value="0" id="Remove" />
12 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 27 </project>
15 28 \ No newline at end of file
... ...
.idea/scopes/scope_settings.xml 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<component name="DependencyValidationManager">
  2 + <state>
  3 + <option name="SKIP_IMPORT_STATEMENTS" value="false" />
  4 + </state>
  5 +</component>
0 6 \ No newline at end of file
... ...
.idea/workspace.xml
... ... @@ -11,8 +11,8 @@
11 11 <component name="CreatePatchCommitExecutor">
12 12 <option name="PATCH_PATH" value="" />
13 13 </component>
14   - <component name="NamedScopeManager">
15   - <order />
  14 + <component name="DaemonCodeAnalyzer">
  15 + <disable_hints />
16 16 </component>
17 17 <component name="ProjectLevelVcsManager" settingsEditedManually="false">
18 18 <OptionsSetting value="true" id="Add" />
... ... @@ -24,18 +24,24 @@
24 24 <ConfirmationsSetting value="0" id="Add" />
25 25 <ConfirmationsSetting value="0" id="Remove" />
26 26 </component>
  27 + <component name="RunManager">
  28 + <list size="0" />
  29 + </component>
27 30 <component name="ShelveChangesManager" show_recycled="false" />
28 31 <component name="TaskManager">
29 32 <task active="true" id="Default" summary="Default task">
30   - <created>1434792298659</created>
31 33 <option name="number" value="Default" />
32   - <updated>1434792298659</updated>
33 34 </task>
34 35 <servers />
35 36 </component>
36 37 <component name="VcsContentAnnotationSettings">
37 38 <option name="myLimit" value="2678400000" />
38 39 </component>
  40 + <component name="VcsManagerConfiguration">
  41 + <option name="myTodoPanelSettings">
  42 + <TodoPanelSettings />
  43 + </option>
  44 + </component>
39 45 <component name="XDebuggerManager">
40 46 <breakpoint-manager />
41 47 <watches-manager />
... ...
chap1/1_3_infiniteseries.py
1 1 __author__ = 'chunk'
2 2  
3 3 import struct
4   -
  4 +import numpy as np
5 5  
6 6 def float2bits(f, fmt='bin'):
7 7 if fmt == 'hex':
... ... @@ -30,14 +30,13 @@ def double2bin(num):
30 30  
31 31  
32 32 def infiniteseries():
33   - s = 0
34   - tmp = -1
  33 + s = np.float32(0)
  34 + tmp = np.float32(-1)
35 35 i = 0
36   - while float(s) != float(tmp):
  36 + while s != tmp:
37 37 i += 1
38 38 tmp = s
39   - s += float(1.0 / i)
40   - print tmp,s
  39 + s += np.float32(1.0 / i)
41 40  
42 41 print i, s, tmp
43 42  
... ...