It would be helpful if you posted the exact code that results in an error, complete with (possibly randomly generated) values for xv and yv. Until then, nobody can actually run your code, making it harder to help…
It would be helpful if you posted the exact code that results in an error, complete with (possibly randomly generated) values for xv and yv. Until then, nobody can actually run your code, making it harder to help…