Re: [Tutor] Convert doesn't work... I'm stumped

2005-03-16 Thread Jacob S.
Oh, god!! I found my problem... I was using the inverses incorrectly -- in Advanced Calculus and I can't even do algebra correctly. To make a long story short, in the second functions I was putting the x in the denominator when it needs to be in the numerator... But! Your post is not in vain, D

Re: [Tutor] Convert doesn't work... I'm stumped

2005-03-16 Thread Danny Yoo
> > A table that stores a similar amount of information might be something > like this: > > ### > meterRatios = { 'm' : D(1), ## 1 meter == 1 meter > 'km' : D(1000),## 1000 meters == 1 kilometer > 'cm' : D(1)/D(100),## .001 meters == 1 c

Re: [Tutor] Convert doesn't work... I'm stumped

2005-03-16 Thread Danny Yoo
On Tue, 15 Mar 2005, Jacob S. wrote: > Okay, not a very descriptive subject, but here goes... > > This is the code Hi Jacob, > from decimal import Decimal as D Ok, I think I see why you're using this, but you have to be aware that the decimal module itself is susceptible to imprecision:

Re: [Tutor] Convert doesn't work... I'm stumped

2005-03-15 Thread jfouhy
Quoting "Jacob S." <[EMAIL PROTECTED]>: > But, I digress--to the problem... > If I call convert(3,'ft','yd'), I should get Decimal("1") > instead, I get Decimal("1.195990046301080256481500617") At the risk of being blindingly obvious --- ft[0] is lambda x:381*x/1250 yd[1] is lambda x:1250/(1143*

[Tutor] Convert doesn't work... I'm stumped

2005-03-15 Thread Jacob S.
Okay, not a very descriptive subject, but here goes... This is the code ### from decimal import Decimal as D """Everything is first converted to meters, and then converted to the unit you want to extend usage. dic[unit] = (unittometers,meterstounit) """ dic =