'use strict';

/**
 * Common Math expressions.
 *
 * @module math
 */

const floor = Math.floor;
const abs = Math.abs;

/**
 * @function
 * @param {number} a
 * @param {number} b
 * @return {number} The smaller element of a and b
 */
const min = (a, b) => a < b ? a : b;

/**
 * @function
 * @param {number} a
 * @param {number} b
 * @return {number} The bigger element of a and b
 */
const max = (a, b) => a > b ? a : b;

const pow = Math.pow;

/**
 * Check whether n is negative, while considering the -0 edge case. While `-0 < 0` is false, this
 * function returns true for -0,-1,,.. and returns false for 0,1,2,...
 * @param {number} n
 * @return {boolean} Wether n is negative. This function also distinguishes between -0 and +0
 */
const isNegativeZero = n => n !== 0 ? n < 0 : 1 / n < 0;

exports.abs = abs;
exports.floor = floor;
exports.isNegativeZero = isNegativeZero;
exports.max = max;
exports.min = min;
exports.pow = pow;
//# sourceMappingURL=math.js.map
