[前][次][番号順一覧][スレッド一覧][生データ]

yarv-dev-en:300

From: vikas vaid <ruby-forum-incoming andreas-s.net>
Date: Fri, 18 May 2007 20:58:56 +0200
Subject: [yarv-dev-en:300] Re: YARV

Hi,

try this code..
require "mathn"
puts getTime=Time.now
# normal standard deviation test"
 def variance(population)
            n = 0
            mean = 0.0
            s = 0.0


            population.each { |x|
              n = n + 1
              delta = x.to_f - mean.to_f
              mean = mean.to_f + (delta.to_f / n).to_f
              s = s + delta.to_f * (x.to_f - mean.to_f).to_f
            }


            # if you want to calculate std deviation
            # of a sample change this to "s / (n-1)"

            return (s / (n-1)).to_f
          end

chk_Arr=[632,567,936,109,180,23,369,284,40,36,233,280,752,293,84]

puts  Math.sqrt(variance(chk_Arr))


Superclass mismatch for class rational...

error i get is ..

Superclass mismatch for class rational...

any idea....

Thanks
SASADA Koichi wrote:
> Hi,
> 
> On my environment:
> 
> # ./ruby -v
> ruby 1.9.0 (2007-05-17 patchlevel 0) [i686-linux]
> # make runruby
> ./miniruby  ../trunk/runruby.rb --extout=.ext -- ../trunk/test.rb
> hello world
> 
> Any other hint?


-- 
Posted via http://www.ruby-forum.com/.

--
ML: yarv-dev-en quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]

   @   296 2007-05-12 01:13 [vaid.vikas gmail.com] YARV                                    
       298 2007-05-18 13:27 ┗[ko1 atdot.net       ]                                       
->     300 2007-05-19 03:58  ┗[ruby-forum-incoming ]                                     
       301 2007-05-19 23:18   ┗[ko1 atdot.net       ]                                   
       305 2007-06-07 06:05    ┗[ruby-forum-incoming ]                                 
       306 2007-06-07 08:32     ┗[ko1 atdot.net       ]                               
       307 2007-06-07 12:19      ┗[ruby-forum-incoming ]