python - Strange accuracy difference between ipython and ipython notebook then using fortran module with f2py -
i'm encountering strange accuracy difference between ipython , ipython notebook when using fortran module compiled f2py.
my fortran module is:
subroutine tt(string,fmt,n_num,out) implicit none integer,intent(in)::n_num character(len=*),intent(in)::string character(len=*),intent(in)::fmt double precision,intent(out)::out(n_num) read(string,fmt) out end subroutine tt
compiling with: f2py -c -m andre tt.f90
in ipython get:
in [1]: import numpy np in [2]: import andre in [3]: out = np.array(andre.tt(' 0.34 4.56 5.67','(3f5.2)',3),dtype=np.float) in [4]: print out [ 0.34 4.56 5.67]
which desired output. however, in ipython notebook, using same code, get:
print out print out+0.0001 [ 0. 4. 5.] [ 1.00000000e-04 4.00010000e+00 5.00010000e+00]
what doing wrong?
Comments
Post a Comment