Sqrt
should return a non-nil error value when given a negative number, as it doesn't support complex numbers.
and make it an error
by giving it a
Note: A call to fmt.Sprint(e)
inside the Error
method will send the program into an infinite loop. You can avoid this by converting first: fmt.Sprint(float64(e))
. Why?
exercise-errors.go