<commit_before>/** @param {number} re
 *  @param {number} im
 *  @constructor */
function Complex(re, im) {
    this.re = re;
    this.im = im;
}

/** @return {number} */
Complex.prototype.abs = function() {
    return Math.sqrt(this.abs2());
};

/** @return {number} */
Complex.prototype.abs2 = function() {
    return this.re * this.re + this.im * this.im;
};

/** @param {Complex} a
 *  @param {Complex} b
 *  @return {Complex} */
Complex.add = function(a, b) {
    return new Complex(a.re + b.re, a.im + b.im);
};

/** @param {Complex} b
 *  @return {Complex} */
Complex.prototype.add = function(b) {
    return Complex.add(this, b);
};

/** @param {Complex} a
 *  @param {Complex} b
 *  @return {Complex} */
Complex.div = function(a, b) {
    var abs2 = b.abs2();
    var re = a.re * b.re + a.im * b.im;
    var im = a.im * b.re - a.re * b.im;
    return new Complex(re / abs2, im / abs2);
};

/** @param {Complex} z
 *  @return {Complex} */
Complex.inv = function(z) {
    var abs2 = z.abs2();
    return new Complex(z.re / abs2, -z.im / abs2);
};

/** @param {Complex} a
 *  @param {Complex} b
 *  @return {Complex} */
Complex.mul = function(a, b) {
    return new Complex(a.re * b.re - a.im * b.im, a.re * b.im + a.im * b.re);
};

/** @param {Complex} b
 *  @return {Complex} */
Complex.prototype.mul = function(b) {
    return Complex.mul(this, b);
};

/** @return {Complex} */
Complex.prototype.neg = function() {
    return new Complex(-this.re, -this.im);
};

/** @type {Complex} */
Complex.one = new Complex(1, 0);

/** @param {number} re
 *  @return {Complex} */
Complex.real = function(re) {
    return new Complex(re, 0);
};

/** @param {Complex} z
 *  @return {Complex} */
Complex.sqrt = function(z) {
    var r = z.abs();
    var s = Math.sign(z.im);
    return new Complex(Math.sqrt((r + z.re) * 0.5), s * Math.sqrt((r - z.re) *
        0.5));
};

/** @param {Complex} a
 *  @param {Complex} b
 *  @return {Complex} */
Complex.sub = function(a, b) {
    return new Complex(a.re - b.re, a.im - b.im);<commit_msg>Fix Complex.sqrt<commit_after>/** @param {number} re
 *  @param {number} im
 *  @constructor */
function Complex(re, im) {
    this.re = re;
    this.im = im;
}

/** @return {number} */
Complex.prototype.abs = function() {
    return Math.sqrt(this.abs2());
};

/** @return {number} */
Complex.prototype.abs2 = function() {
    return this.re * this.re + this.im * this.im;
};

/** @param {Complex} a
 *  @param {Complex} b
 *  @return {Complex} */
Complex.add = function(a, b) {
    return new Complex(a.re + b.re, a.im + b.im);
};

/** @param {Complex} b
 *  @return {Complex} */
Complex.prototype.add = function(b) {
    return Complex.add(this, b);
};

/** @param {Complex} a
 *  @param {Complex} b
 *  @return {Complex} */
Complex.div = function(a, b) {
    var abs2 = b.abs2();
    var re = a.re * b.re + a.im * b.im;
    var im = a.im * b.re - a.re * b.im;
    return new Complex(re / abs2, im / abs2);
};

/** @param {Complex} z
 *  @return {Complex} */
Complex.inv = function(z) {
    var abs2 = z.abs2();
    return new Complex(z.re / abs2, -z.im / abs2);
};

/** @param {Complex} z
 *  @return {boolean} */
Complex.isZero = function(z) {
    return z.re === 0 && z.im === 0;
};

/** @param {Complex} a
 *  @param {Complex} b
 *  @return {Complex} */
Complex.mul = function(a, b) {
    return new Complex(a.re * b.re - a.im * b.im, a.re * b.im + a.im * b.re);
};

/** @param {Complex} b
 *  @return {Complex} */
Complex.prototype.mul = function(b) {
    return Complex.mul(this, b);
};

/** @return {Complex} */
Complex.prototype.neg = function() {
    return new Complex(-this.re, -this.im);
};

/** @type {Complex} */
Complex.one = new Complex(1, 0);

/** @param {number} re
 *  @return {Complex} */
Complex.real = function(re) {
    return new Complex(re, 0);
};

/** @param {Complex} z
 *  @return {Complex} */
Complex.sqrt = function(z) {
    if (Complex.isZero(z))
        return Complex.zero;
    var r = z.abs();
    var s = Math.sign(z.im) || 1;
    return new Complex(Math.sqrt((r + z.re) * 0.5), s * Math.sqrt((r - z.re) *
        0.5));
};

/** @param {Complex} a
 *  @param {Complex} b
 *  @return {Complex} */
Complex.sub = function(a, b) {
    return new Complex(a.re - b.re, a.im - b.im);
{'fraction_non_alphanumeric': 0.21347785108388312, 'fraction_numerical': 0.008718190386427899, 'mean_word_length': 2.653184165232358, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7403997', 'n_tokens_mistral': 1642, 'n_tokens_neox': 1632, 'n_words': 417}