[pypy-issue] [issue1302] numpypy arange difference from numpy

mikefc tracker at bugs.pypy.org
Thu Oct 25 06:34:36 CEST 2012


New submission from mikefc <coolbutuseless at gmail.com>:

I was looking at the equivalent python benchmark for the julia language: 
https://raw.github.com/JuliaLang/julia/master/test/perf/perf.py 

The mandelperf() benchmark (runnable snippet attached) returns slightly different 
results, because, ultimately, there's a slight difference in the "almost 0" values 
returned by numpy.arange()  i.e. 6.38378239e-16 != 1.77635684e-15

Should we expect these "almost zero" values to be the same?  

-------------------------------
pypy (latest nightly)
-------------------------------
>>>> numpy.arange(-2, 0.5, 0.1, dtype='f8')
array([ -2.00000000e+00,  -1.90000000e+00,  -1.80000000e+00,
        -1.70000000e+00,  -1.60000000e+00,  -1.50000000e+00,
        -1.40000000e+00,  -1.30000000e+00,  -1.20000000e+00,
        -1.10000000e+00,  -1.00000000e+00,  -9.00000000e-01,
        -8.00000000e-01,  -7.00000000e-01,  -6.00000000e-01,
        -5.00000000e-01,  -4.00000000e-01,  -3.00000000e-01,
        -2.00000000e-01,  -1.00000000e-01,   6.38378239e-16,
         1.00000000e-01,   2.00000000e-01,   3.00000000e-01,
         4.00000000e-01])


numpy v1.6
-------------------------------
>>> numpy.arange(-2, 0.5, 0.1, dtype='f8')
array([ -2.00000000e+00,  -1.90000000e+00,  -1.80000000e+00,
        -1.70000000e+00,  -1.60000000e+00,  -1.50000000e+00,
        -1.40000000e+00,  -1.30000000e+00,  -1.20000000e+00,
        -1.10000000e+00,  -1.00000000e+00,  -9.00000000e-01,
        -8.00000000e-01,  -7.00000000e-01,  -6.00000000e-01,
        -5.00000000e-01,  -4.00000000e-01,  -3.00000000e-01,
        -2.00000000e-01,  -1.00000000e-01,   1.77635684e-15,
         1.00000000e-01,   2.00000000e-01,   3.00000000e-01,
         4.00000000e-01])

----------
files: mandelperf.py
messages: 4907
nosy: mikefc, pypy-issue
priority: bug
status: unread
title: numpypy arange difference from numpy

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1302>
________________________________________


More information about the pypy-issue mailing list