Fix overflow and underflow in regr_r2()

Fix overflow and underflow in regr_r2()

Edit