Fix for #224: Fractional radical simplification

Fix for issue #224.
Yes, `r` can be negative. Actually, I originally assumed it was positive, but it gave wrong results then. So I added this check.