<commit_before><?php
namespace Math\NumericalAnalysis\RootFinding;

/**
 * Common validation methods for root finding techniques
 */
class RootFindingValidation
{
    /**
     *
     */
    public static function tolerance($tol) {
        if ($tol < 0) {
            throw new \Exception('Tolerance must be greater than zero.');
        }
    }

    /**
     *
     */
    public static function interval($a, $b)
    {
        if ($a === $b) {
            throw new \Exception('Start point and end point of interval
                                    cannot be the same.');
        }
    }
}<commit_msg>Added comments, descriptions to root finding validation trait<commit_after><?php
namespace Math\NumericalAnalysis\RootFinding;

/**
 * Common validation methods for root finding techniques
 */
trait RootFindingValidation
{
    /**
     * Throw an exception if the tolerance is negative.
     *
     * @param number $tol Tolerance; How close to the actual solution we would like.
     *
     * @throws Exception if $tol (the tolerance) is negative
     */
    public static function tolerance($tol) {
        if ($tol < 0) {
            throw new \Exception('Tolerance must be greater than zero.');
        }
    }

    /**
     * Verify that the start and end of of an interval are distinct numbers.
     *
     * @param number $a The start of the interval
     * @param number $b The end of the interval
     *
     * @throws Exception if $a = $b
     */
    public static function interval($a, $b)
    {
        if ($a === $b) {
            throw new \Exception('Start point and end point of interval
                                    cannot be the same.');
        }
    }
}
{'fraction_non_alphanumeric': 0.09863339275103981, 'fraction_numerical': 0.0011883541295306002, 'mean_word_length': 1.9185441941074524, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3313222', 'n_tokens_mistral': 441, 'n_tokens_neox': 432, 'n_words': 168}