<commit_before>import math
import sympy.mpmath as mpmath
import sympy.mpmath.libmpf as mlib
from sympy.mpmath.libmpf import mpf_abs
import sympy.mpmath.libmpc as mlibc
from sympy.mpmath.libelefun import mpf_pow, mpf_pi, phi_fixed
import decimal

rnd = mlib.round_nearest

from basic import Basic, Atom, S, C, SingletonMeta, Memoizer, MemoizerArg
from sympify import _sympify, SympifyError, _sympifyit
from power import integer_nthroot

# from mul import Mul   /cyclic/
# from power import Pow /cyclic/
# from function import FunctionClass    /cyclic/

_errdict = {"divide": False}
def seterr(divide=False):
    """
    Should sympy raise an exception on 0/0 or return a nan?

    divide == True .... raise an exception
    divide == False ... return nan
    """
    _errdict["divide"] = divide

# (a,b) -> gcd(a,b)
_gcdcache = {}

# TODO caching with decorator, but not to degrade performance
def igcd(a, b):
    """Computes integer greates common divisor of two numbers.

       The algorithm is based on the well known Euclid's algorithm. To
       improve speed igcd() has its own caching mechanizm implemented.
    """
    try:
        return _gcdcache[(a,b)]
    except KeyError:
        if a and b:
            if b < 0:
                b = -b

            while b:
                a, b = b, a % b
        else:
            a = abs(a or b)

        _gcdcache[(a,b)] = a
        return a

def ilcm(a, b):
    """Computes integer least common multiple of two numbers. """
    if a == 0 and b == 0:
        return 0
    else:
        return a * b // igcd(a, b)

def igcdex(a, b):
    """Returns x, y, g such that g = x*a + y*b = gcd(a, b).

       >>> igcdex(2, 3)
       (-1, 1, 1)
       >>> igcdex(10, 12)
       (-1, 1, 2)
<commit_msg>numbers.py: small docstring improvement<commit_after>import math
import sympy.mpmath as mpmath
import sympy.mpmath.libmpf as mlib
from sympy.mpmath.libmpf import mpf_abs
import sympy.mpmath.libmpc as mlibc
from sympy.mpmath.libelefun import mpf_pow, mpf_pi, phi_fixed
import decimal

rnd = mlib.round_nearest

from basic import Basic, Atom, S, C, SingletonMeta, Memoizer, MemoizerArg
from sympify import _sympify, SympifyError, _sympifyit
from power import integer_nthroot

# from mul import Mul   /cyclic/
# from power import Pow /cyclic/
# from function import FunctionClass    /cyclic/

_errdict = {"divide": False}
def seterr(divide=False):
    """
    Should sympy raise an exception on 0/0 or return a nan?

    divide == True .... raise an exception
    divide == False ... return nan
    """
    _errdict["divide"] = divide

# (a,b) -> gcd(a,b)
_gcdcache = {}

# TODO caching with decorator, but not to degrade performance
def igcd(a, b):
    """Computes integer greates common divisor of two numbers.

       The algorithm is based on the well known Euclid's algorithm. To
       improve speed, igcd() has its own caching mechanizm implemented.
    """
    try:
        return _gcdcache[(a,b)]
    except KeyError:
        if a and b:
            if b < 0:
                b = -b

            while b:
                a, b = b, a % b
        else:
            a = abs(a or b)

        _gcdcache[(a,b)] = a
        return a

def ilcm(a, b):
    """Computes integer least common multiple of two numbers. """
    if a == 0 and b == 0:
        return 0
    else:
        return a * b // igcd(a, b)

def igcdex(a, b):
    """Returns x, y, g such that g = x*a + y*b = gcd(a, b).

       >>> igcdex(2, 3)
       (-1, 1, 1)
       >>> igcdex(10, 12)
       (-1, 1, 2)

{'fraction_non_alphanumeric': 0.10737681572201652, 'fraction_numerical': 0.010253489034463116, 'mean_word_length': 2.3543457497612224, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 17, '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': '6162491', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1184, 'n_words': 427}