lib/linefit.rb
############################################################################
# Verify that the input x-y data are numeric
#
Verify that the input x-y data are numeric
Verify that the input x - y data are numeric
def validData
      0.upto(@numxy-1) do |i|
         unless @x[i]
            puts "Input x[#{i}] is not defined" unless @hush
            return false
         end
         if @x[i] !~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/
            puts "Input x[#{i}] is not a number: #{@x[i]}" unless @hush
            return false
         end
         unless @y[i]
            puts "Input y[#{i}] is not defined" unless @hush
            return false
         end
         if @y[i] !~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/
            puts "Input y[#{i}] is not a number: #{@y[i]}" unless @hush
            return false
         end
      end
      return true
   end
def validData 0 . upto ( @numxy - 1 ) do | i | unless @x [ i ] puts "Input x[#{i}] is not defined" unless @hush return false end if @x [ i ] !~ / ^([+-]?)(?= \d | \. \d ) \d *( \. \d *)?([Ee]([+-]? \d +))?$ / puts "Input x[#{i}] is not a number: #{@x[i]}" unless @hush return false end unless @y [ i ] puts "Input y[#{i}] is not defined" unless @hush return false end if @y [ i ] !~ / ^([+-]?)(?= \d | \. \d ) \d *( \. \d *)?([Ee]([+-]? \d +))?$ / puts "Input y[#{i}] is not a number: #{@y[i]}" unless @hush return false end end return true end
Verify that the input x-y data are numeric
Verify that the input x - y data are numeric