On Mon, Feb 25, 2008 at 3:53 PM, Christian Rubio
<chris.rubio.osv / fedex.com> wrote:
> Jano Svitok wrote:
>  > On Mon, Feb 25, 2008 at 3:18 PM, Christian Rubio
>  > <chris.rubio.osv / fedex.com> wrote:
>  >
>  >> Help I am completely new to ruby and to OO programming. Why-does my code
>  >>  not compile??
>  >>
>  >>
>
> > Replace
>  >
>  >>         b = (ARGV[0])
>  >>         c = (ARGV[1])
>  >>
>  > by
>  >          b = ARGV[0].to_f
>  >          c = ARGV[1].to_f
>  > to_f will convert string to float. For more info, read the docs of
>  > String#to_f and possibly the whole String class
>  > (e.g. using RI or http://ruby-doc.org/core/)
>  >
>  > If the message is different, please post it and will see.
>  >
>  > Jano
>  >
>  >
>  Hi Thanks for your help and directions. I made the above substitutions
>  and now I get the following error
>
>  %  ruby quadratic.rb 1.0 1.0
>  You entered 1.0 1.0
>  quadratic.rb:17:in `sqrt': Numerical argument out of domain - sqrt
>  (Errno::EDOM)
>         from quadratic.rb:17:in `findroots'
>         from quadratic.rb:30

That means you passed a number that has no real square root, for example -1.
Refresh your high school math and check the discriminant before you
call Math.sqrt ;-)
Otherwise, require 'complex' ;-)

Jano