From: Mahadev Ittina Date: 2009-11-06T06:35:10+09:00 Subject: Re: question about variables in ruby Jes炭s Gabriel y Gal叩n wrote:> > This calculation is correct: 2.1, so if you are getting a different > result it has to be that @b or @h don't contain what you think they > do. Can you try to print @b, @h and weight, and show us the calling > code that produces weight being 0.00032? > > def moment_calc > puts "@b is #{@b}" > puts "@h is #{@h}" > weight =((25.0*@b*@h) / 10**6) > puts "weight is #{weight}" > end > > If you put this in your program, what happens? > > Jesus. actually since this is sketchup, i cannot output data in terms of puts... i have to make a vcb messagebox or a UI messagebox,, both of which are visual outputs,, Also I am unable to use bigDecimal in the ruby script even when i put "require 'bigdecimal'" in the beginning it is not supported by it.. but you have to believe me it does come as 0.00032 as i saif and not 2.1! its quiet frustrating.. -- Posted via http://www.ruby-forum.com/.