<commit_before>#include "misc.h"
#include <math.h>

#define MAX_ITERATIONS              100
#define FP_CMP_WITH_BISECT_NITER    4
#define FP_CMP_WITH_BISECT_WIDTH    4.0

static inline double
max(double a, double b)
{
    return (a > b ? a : b);
}

/*
   Use a combination of bisection and false position to find a root
   of a function within a given interval. This is guaranteed to converge,
   and always keeps a bounding interval, unlike Newton's method.

   The false position steps are either unmodified, or modified with
   the Anderson-Bjorck method as appropiate. Theoretically, this has
   a "speed of convergence" of 1.7 (bisection is 1, Newton is 2).

   Input
   -----
    a, b:   initial bounding interval
    fa, fb: value of f() at a and b
    f, f_extra: function to find root of is f(x, f_extra)
    abserr, relerr: absolute and relative errors on the bounding interval
    bisect_til: If > 0.0, perform bisection until the width of the
                bounding interval is less than this.

   Output
   ------
    a, b, fa, fb: Final bounding interval and function values
    best_x, best_f: Best root approximation and the function value there

   Returns
   -------
    FSOLVE_CONVERGED: Bounding interval is smaller than required error.<commit_msg>Remove inline keyword to fix ticket #924.<commit_after>#include "misc.h"
#include <math.h>

#define MAX_ITERATIONS              100
#define FP_CMP_WITH_BISECT_NITER    4
#define FP_CMP_WITH_BISECT_WIDTH    4.0

static double
max(double a, double b)
{
    return (a > b ? a : b);
}

/*
   Use a combination of bisection and false position to find a root
   of a function within a given interval. This is guaranteed to converge,
   and always keeps a bounding interval, unlike Newton's method.

   The false position steps are either unmodified, or modified with
   the Anderson-Bjorck method as appropiate. Theoretically, this has
   a "speed of convergence" of 1.7 (bisection is 1, Newton is 2).

   Input
   -----
    a, b:   initial bounding interval
    fa, fb: value of f() at a and b
    f, f_extra: function to find root of is f(x, f_extra)
    abserr, relerr: absolute and relative errors on the bounding interval
    bisect_til: If > 0.0, perform bisection until the width of the
                bounding interval is less than this.

   Output
   ------
    a, b, fa, fb: Final bounding interval and function values
    best_x, best_f: Best root approximation and the function value there

   Returns
   -------
    FSOLVE_CONVERGED: Bounding interval is smaller than required error.
{'fraction_non_alphanumeric': 0.06950409996095275, 'fraction_numerical': 0.010542756735650137, 'mean_word_length': 2.8995433789954337, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2203864', 'n_tokens_mistral': 804, 'n_tokens_neox': 749, 'n_words': 342}