Re: [BangPypers] strange behavior

2008-07-10 Thread Nanolets nanolets
http://www.python.org/doc/current/lib/typesnumeric.html for Documentation Specifically For (plain or long) integer division, the result is an integer. The result is always rounded towards minus infinity: 1/2 is 0, (-1)/2 is -1, 1/(-2) is -1, and (-1)/(-2) is 0. Note that the result is a long inte

Re: [BangPypers] strange behavior

2008-07-10 Thread Sidharth Kuruvila
Any number with a decimal point is treated as an object of type float and the numbers without a decimal point of are treated as ints. You can use the type function to find the type of an object. >>> type(1) >>> type(1.0) >>> 1+1.0 2.0 Arithmetic operations over two types give the result in the

Re: [BangPypers] strange behavior

2008-07-09 Thread Pradeep Gowda
On Jul 10, 2008, at 12:54 AM, Gopal Ghosh wrote: * >>> 7/3 2 >>> 7/-3 -3 >>> 3/7 0 >>> # again reapting the questions with one more decimal place >>> 7.0/3 2.3335 >>> 7.0/-3 -2.3335 >>> 3.0/7 0.42857142857142855 >>> # why it is not showing the exact

[BangPypers] strange behavior

2008-07-09 Thread Gopal Ghosh
Dear sir / madam I am a new user of python and this is my first mail to local user group of python. I came across a strange behavior pf python n unable to explain it * >>> 7/3 2 >>> 7/-3 -3 >>> 3/7 0 >>> # again reapting the questions with one more decimal place >>> 7.0/3 2.33