From: superpollo on 1 Apr 2010 16:44 how much is one half times one half?
From: Tim Chase on 1 Apr 2010 17:42 superpollo wrote: > how much is one half times one half? Uh, did you try it at the python prompt? If not, here's the answer: 0.1b * 0.1b = 0.01b Now all you need is to find the recent thread that converts binary floats to decimal floats ;-) -tkc
From: Patrick Maupin on 1 Apr 2010 19:34 On Apr 1, 4:42 pm, Tim Chase <python.l...(a)tim.thechases.com> wrote: > superpollo wrote: > > how much is one half times one half? > > Uh, did you try it at the python prompt? If not, here's the answer: > > 0.1b * 0.1b = 0.01b > > Now all you need is to find the recent thread that converts > binary floats to decimal floats ;-) > > -tkc I thought it was 0b0.1 * 0b0.1 == 0b0.01 Otherwise, you might get it confused with hexadecimal floats :D
From: David Robinow on 1 Apr 2010 19:55 On Thu, Apr 1, 2010 at 7:34 PM, Patrick Maupin <pmaupin(a)gmail.com> wrote: > On Apr 1, 4:42 pm, Tim Chase <python.l...(a)tim.thechases.com> wrote: >> superpollo wrote: >> > how much is one half times one half? >> >> Uh, did you try it at the python prompt? If not, here's the answer: >> >> 0.1b * 0.1b = 0.01b >> >> Now all you need is to find the recent thread that converts >> binary floats to decimal floats ;-) >> >> -tkc > > I thought it was 0b0.1 * 0b0.1 == 0b0.01 > > Otherwise, you might get it confused with hexadecimal floats :D Well, my python says: $ python -c "print 1/2 * 1/2" 0 But that's not what I learned in grade school. (Maybe I should upgrade to 3.1?)
From: Tim Chase on 1 Apr 2010 20:49
David Robinow wrote: > $ python -c "print 1/2 * 1/2" > 0 > > But that's not what I learned in grade school. > (Maybe I should upgrade to 3.1?) That's because you need to promote one of them to a float so you get a floating-point result: >>> 1/2 * 1/2 0 >>> 1/2 * 1/2.0 0.0 Oh...wait ;-) -tkc |