On the calculation of regulators and class numbers of quadratic fields