ph-math/src/main/java/com/helger/numbercruncher/mathutils/RegressionLine.java
private void _validateCoefficients ()
  {
    if (m_bCoefsValid)
      return;

    if (m_nDataPoints >= 2)
    {
      final float xBar = (float) m_dSumX / m_nDataPoints;
      final float yBar = (float) m_dSumY / m_nDataPoints;

      m_fA1 = (float) ((m_nDataPoints * m_dSumXY - m_dSumX * m_dSumY) / (m_nDataPoints * m_dSumXX - m_dSumX * m_dSumX));
      m_fA0 = yBar - m_fA1 * xBar;
    }
    else
    {
      m_fA0 = m_fA1 = Float.NaN;
    }

    m_bCoefsValid = true;
  }
private void _validateCoefficients ()
  {
    if (m_bCoefsValid)
      return;

    if (m_nDataPoints >= 2)
    {
      final float xBar = (float) m_dSumX / m_nDataPoints;
      final float yBar = (float) m_dSumY / m_nDataPoints;

      m_fA1 = (float) ((m_nDataPoints * m_dSumXY - m_dSumX * m_dSumY) / (m_nDataPoints * m_dSumXX - m_dSumX * m_dSumX));
      m_fA0 = yBar - m_fA1 * xBar;
    }
    else
    {
      m_fA0 = m_fA1 = Float.NaN;
    }

    m_bCoefsValid = true;
  }
Validate the coefficients.