HEX
Server: Apache
System: Linux vps.mmtprep.com 4.18.0-477.21.1.el8_8.x86_64 #1 SMP Thu Aug 10 13:51:50 EDT 2023 x86_64
User: mmtprep (1001)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/mmtprep/public_html/mathzen.mmtprep.com/assets/Relatif-YKH2MTwh.js.map
{"version":3,"file":"Relatif-YKH2MTwh.js","sources":["../../src/modules/Relatif.js"],"sourcesContent":["/**\n * @class\n * @classdesc Classe Relatif - Méthodes utiles sur les relatifs\n * @param {...any} relatifs est un paramètre du reste\n * @author Sébastien Lozano\n */\nexport class Relatif {\n  constructor (...relatifs) {\n    this.relatifs = relatifs\n  }\n\n  /**\n   * * Récupère le signe de chaque relatif déclaré dans le paramètre du reste relatifs,\n   * * Si 0 fait partie des relatifs on renvoie une erreur\n   * @return {array} Renvoie un tableau de -1 ou 1\n   * @example getSigneNumber(-1,-2,8,-9,4) renvoie [-1,-1,1,-1,1]\n   */\n  getSigneNumber () {\n    const signes = []\n    try {\n      // wearing a thong is prohibited!\n      this.relatifs.forEach(function (element) {\n        if (typeof element === 'string') {\n          throw new TypeError(`${element} is a thong!`)\n        }\n        if (element === 0) {\n          throw new RangeError(`${element} has been excluded from possible values.`)\n        }\n      })\n      // What to do without numbers?\n      if (this.relatifs.length === 0) {\n        throw new Error('It\\'s better with a few numbers!')\n      }\n      this.relatifs.forEach(function (element) {\n        if (element < 0) {\n          signes.push(-1)\n        }\n        if (element > 0) {\n          signes.push(1)\n        }\n      })\n    } catch (err) {\n      console.log(err.message)\n      console.log(err.stack)\n    }\n    return signes\n  }\n\n  /**\n   * * Récupère le signe de chaque relatif déclaré dans le paramètre du reste relatifs\n   * @return {array} Renvoie un tableau de strings valant 'negative' ou 'positive'\n   * @example getSigneNumber(-1,-2,8,-9,4) renvoie le tableau de strings [négatif,négatif,positif,négatif,positif]\n   */\n  getSigneString () {\n    const signesString = []\n    const signes = this.getSigneNumber()\n    signes.forEach(function (element) {\n      if (element === -1) {\n        signesString.push('negative')\n      }\n      if (element === 1) {\n        signesString.push('positive')\n      }\n    })\n    return signesString\n  }\n\n  /**\n   *\n   * @param  {...any} n une liste de deux ou plus de nombres relatifs\n   * @return {number} Renvoie le signe du produit des nombres de cette liste. 1 ou -1\n   * @example getSigneProduitNumber(1,-4,-7) renvoie 1\n   */\n\n  getSigneProduitNumber (...n) {\n    let produit = 1\n    try {\n      // wearing a thong is prohibited!\n      n.forEach(function (element) {\n        if (typeof element === 'string') {\n          throw new TypeError(`${element} is a thong!`)\n        }\n        if (element === 0) {\n          throw new RangeError(`${element} has been excluded from possible values.`)\n        }\n      })\n      // What to do without numbers?\n      if (n.length === 0) {\n        throw new Error('It\\'s better with a few numbers!')\n      }\n      n.forEach(function (element) {\n        produit = produit * element\n      })\n      if (produit < 0) {\n        return -1\n      }\n      if (produit > 0) {\n        return 1\n      }\n    } catch (err) {\n      console.log(err.message)\n      console.log(err.stack)\n    }\n  }\n\n  /**\n   *\n   * @param  {...any} n une liste de deux ou plus de nombres relatifs\n   * @return {string} Renvoie un string désignant le signe du produit des nombres de cette liste. postif1 ou négatif\n   * @example getSigneProduitNumber(1,-4,-7) renvoie le string positif\n   */\n\n  getSigneProduitString (...n) {\n    const produit = this.getSigneProduitNumber(...n)\n    if (produit === -1) {\n      return 'negative'\n    }\n    if (produit === 1) {\n      return 'positive'\n    }\n  }\n\n  /**\n   *\n   * @param  {...any} n une liste de deux ou plus de nombres relatifs\n   * @return {string} Renvoie le nombre d'éléments négatifs des nombres de cette liste.\n   * * la liste d'entiers doit être passé dans un tableau\n   * @example getCardNegatifs([1,-4,-7]) renvoie 2\n   * @example getCardNegatifs([4,-5,7,7,-8,-9]) renvoie 3\n   */\n\n  getCardNegatifs ([...n]) {\n    let card = 0\n    try {\n      // wearing a thong is prohibited!\n      n.forEach(function (element) {\n        if (typeof element === 'string') {\n          throw new TypeError(`${element} is a thong!`)\n        }\n        if (element === 0) {\n          throw new RangeError(`${element} has been excluded from possible values.`)\n        }\n      })\n      // What to do without numbers?\n      if (n.length === 0) {\n        throw new Error('It\\'s better with a few numbers!')\n      }\n      n.forEach(function (element) {\n        if (element < 0) {\n          card = card + 1\n        }\n      })\n      return card\n    } catch (err) {\n      console.log(err.message)\n    }\n  }\n\n  /**\n   * Fonction locale\n   * @param {integer} n un entier désignant le cardinal de facteurs négatifs dans un produit\n   * @return un string au singulier ou au pluriel\n   * @example orth_facteurs_negatifs(0) ou orth_facteurs_negatifs(1) renvoie 'negative factor'\n   * @example orth_facteurs_negatifs(7) renvoie 'negative factors'\n   */\n  orthographeFacteursNegatifs (n) {\n    if (n >= 2) {\n      return 'negative factors'\n    } else {\n      return 'negative factor'\n    }\n  }\n\n  /**\n   * @param  {...any} n une liste de deux ou plus de nombres relatifs qui constituent les facteurs du produit\n   * @return {string} Renvoie la règle qui permet de justifier le signe d'un produit de relatifs adaptée à la liste passée en paramètre.\n   * @example setRegleProduitFacteurs([1,-2,-8,5]) renvoie le string 'There are 2 negative factors, the number of negative factors is even so the product is positive.'\n   */\n\n  setRegleSigneProduit (...n) {\n    try {\n      // wearing a thong is prohibited!\n      n.forEach(function (element) {\n        if (typeof element === 'string') {\n          throw new TypeError(`${element} is a thong!`)\n        }\n      })\n      // What to do without numbers?\n      if (n.length === 0) {\n        throw new Error('It\\'s better with a few numbers!')\n      }\n      if (n.length === 2) {\n        if (this.getCardNegatifs(n) % 2 === 0) {\n          return 'The two factors have the same sign so the product is positive.'\n        } else {\n          return 'The two factors have a different sign so the product is negative.'\n        }\n      } else if (n.length > 2) {\n        if (this.getCardNegatifs(n) % 2 === 0) {\n          if (this.getCardNegatifs(n) === 0) {\n            return 'All factors are positive therefore the product is positive.'\n          } else {\n            return `There is ${this.getCardNegatifs(n)} ${this.orthographeFacteursNegatifs(this.getCardNegatifs(n))}, the number of negative factors is even so the product is positive.`\n          }\n        } else {\n          return `There is ${this.getCardNegatifs(n)} ${this.orthographeFacteursNegatifs(this.getCardNegatifs(n))}, the number of negative factors is odd so the product is negative.`\n        }\n      }\n    } catch (err) {\n      console.log(err.message)\n    }\n  }\n\n  /**\n   *\n   * @param  {...any} num une liste de deux ou plus de nombres relatifs qui constituent les facteurs du numérateur\n   * @param  {...any} den une liste de deux ou plus de nombres relatifs qui constituent les facteurs du dénominateur\n   * @return {string} Renvoie la règle qui permet de justifier le signe d'un produit de relatifs adaptée à la liste passée en paramètre.\n   * @example setRegleProduitQuotient([1,-2],[-8,5]) renvoie le string 'The sum of the negative factors in the numerator and the negative factors in the denominator is 2, this number is even so the quotient is positive.'\n   */\n\n  setRegleSigneQuotient (...n) {\n    try {\n      // wearing a thong is prohibited!\n      n.forEach(function (element) {\n        if (typeof element === 'string') {\n          throw new TypeError(`${element} is a thong!`)\n        }\n      })\n      // What to do without numbers?\n      if (n.length === 0) {\n        throw new Error('It\\'s better with a few numbers!')\n      }\n      if (n.length === 2) {\n        if (this.getCardNegatifs(n) % 2 === 0) {\n          return 'The numerator and denominator have the same sign so the quotient is positive.'\n        } else {\n          return 'The numerator and denominator have a different sign so the quotient is negative.'\n        }\n      } else if (n.length > 2) {\n        if (this.getCardNegatifs(n) % 2 === 0) {\n          if (this.getCardNegatifs(n) === 0) {\n            return 'All factors in the numerator and all factors in the denominator are positive so the quotient is positive.'\n          } else {\n            // return `The sum of the number of negative factors in the numerator and the number of negative factors in the denominator is ${getCardNegatifs(n)}, this number is even so the quotient is positive.`;\n            return `When we count the negative factors of the numerator and denominator, we find ${this.getCardNegatifs(n)}, this number is even so the quotient is positive.`\n          }\n        } else {\n          // return `The sum of the number of negative factors in the numerator and the number of negative factors in the denominator is ${getCardNegatifs(n)}, this number is odd so the quotient is negative.`;\n          return `When we count the negative factors of the numerator and denominator, we find ${this.getCardNegatifs(n)}, this number is odd so the quotient is negative.`\n        }\n      }\n    } catch (err) {\n      console.log(err.message)\n    }\n  }\n}\n"],"names":["Relatif","relatifs","signes","element","err","signesString","n","produit","card"],"mappings":"AAMO,MAAMA,CAAQ,CACnB,eAAgBC,EAA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