{"version":3,"file":"cos.min.mjs","names":[],"sources":["../../../../src/util/misc/cos.ts"],"sourcesContent":["import type { TRadian } from '../../typedefs';\nimport { halfPI } from '../../constants';\n\n/**\n * Calculate the cos of an angle, avoiding returning floats for known results\n * This function is here just to avoid getting 0.999999999999999 when dealing\n * with numbers that are really 1 or 0.\n * @param {TRadian} angle the angle\n * @return {Number} the cosin value for angle.\n */\nexport const cos = (angle: TRadian): number => {\n  if (angle === 0) {\n    return 1;\n  }\n  const angleSlice = Math.abs(angle) / halfPI;\n  switch (angleSlice) {\n    case 1:\n    case 3:\n      return 0;\n    case 2:\n      return -1;\n  }\n  return Math.cos(angle);\n};\n"],"mappings":"iDAUA,MAAa,EAAO,GAAA,CAClB,GAAI,IAAU,EACZ,MAAO,GAGT,OADmB,KAAK,IAAI,EAAA,CAAS,EACrC,CACE,IAAK,GACL,IAAK,GACH,MAAO,GACT,IAAK,GACH,MAAA,GAEJ,OAAO,KAAK,IAAI,EAAA,EAAA,OAAA,KAAA"}