Joseph John wrote: > HI All > I am trying out python > I understoon when > 7/3 gives "2" > But I cannot understand , > when i give 7/-3 gives resuls "-3" > I feel > 7/3 should give -2 > > since integer divison returns floor > Advice requested > Thanks > Joseph John > >>> import math >>> math.floor(-3.2) -4.0 >>> math.floor(-4.1) -5.0 >>> math.floor(4.1) 4.0
The floor is the next lowest integer to the float. floor(-3.000000001) will be -4 floor(3.99999999) will be 3 HTH, -Luke > > > ------------------------------------------------------------------------ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor