[SciPy-user] strange addition behavior

Chris Lee c.j.lee at tnw.utwente.nl
Thu Feb 14 04:20:00 EST 2008


Hi All,

I have encountered some very strange addition behavior. A quick web 
search didn't reveal anything obvious, so I expect that I am 
misunderstanding some aspect of python here.

Code snip:

print 'dividing up the X axis'
print 'current range is ', xCMin, xCMax
xSpace = 0.5*(xCMax - xCMin)
print 'the new span is ', xSpace
xNew = xSpace + xCMin
print 'the boundary value is ', xNew

xCMin = -0.03
xCMax = 0.05
xSpace = 0.04
xNew = 0.07

I expect that xNew = 0.01

The obvious answer is the addition is using the absolute value of both 
parties.... but if this is so, then that is very scary

Running on Intel Core 2 Duo, Ubuntu linux, python 2.5.1, numpy 1.0.3

Cheers
Chris

-- 
**********************************************
*  Chris Lee                                 *
*  Laser physics and nonlinear optics group  *
*  MESA+ Institute                           *
*  University of Twente                      *
*  Phone: ++31 (0)53 489 3968                *
*  fax: ++31 (0) 53 489 1102                 *
**********************************************




More information about the SciPy-User mailing list