Issues with interpreting the correlation(r) and coefficient of determination(R) in gmt regress

I am using gmt regress with -Er -Nw -Fxymc. I am not a statistics expert but my understanding is that the coefficient of determination ® is the correlation coefficient squared, and that it is supposed to be between 0 and 1, and always positive. However, I sometimes get pretty weird values for R, name values that are negative and far outside a range of 0-1; my most extreme example is R = -510157. It is clear that the correlation is crappy when this happens, but I still don’t understand how R is computed, and what such large negative values mean, or what any negative values mean.