Linux迷+Python粉 - 量化https://blog.pythonwood.com/人生苦短,我用PythonTue, 12 Dec 2017 22:12:00 +0800Python量化之数据处理——小数浮点精度问题解决https://blog.pythonwood.com/2017/04/Python%E9%87%8F%E5%8C%96%E4%B9%8B%E6%95%B0%E6%8D%AE%E5%A4%84%E7%90%86%E2%80%94%E2%80%94%E5%B0%8F%E6%95%B0%E6%B5%AE%E7%82%B9%E7%B2%BE%E5%BA%A6%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3/<h3 id="_1">量化金融刚结果:计算出差了一分钱的涨停价<a class="headerlink" href="#_1" title="Permanent link">&para;</a></h3> <p>量化金融用Python,最近在处理浮点问题的时候,发现一个问题,比较有意思,分享出来。</p> <p>python计算79.035的四舍五入结果是79.03,这是错误的。</p> <p>以下是IPython中输入程序语句,IPython能即时编译运算和输出结果。</p> <div class="highlight"><pre><span></span># 计算71.85的涨停价 In [1]: 71.85 * 1 …</pre></div>pythonwoodTue, 18 Apr 2017 14:03:00 +0800tag:blog.pythonwood.com,2017-04-18:/2017/04/Python量化之数据处理——小数浮点精度问题解决/python金融量化数据处理精度问题