UNPKG

@technobuddha/library

Version:
47 lines (46 loc) 1.7 kB
"use strict"; var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = (this && this.__spreadArray) || function (to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.standardDeviation = void 0; var variance_1 = __importDefault(require("../variance")); /** * Returns the sample standard deviation of the arguments. For a definition of * sample standard deviation, see http://en.wikipedia.org/wiki/Standard_deviation * * @param datapoints samples to analyze. * @return The sample standard deviation of the arguments (0 if fewer * than two samples were provided, or NaN if any of the samples is * not a valid number). */ function standardDeviation() { var datapoints = []; for (var _i = 0; _i < arguments.length; _i++) { datapoints[_i] = arguments[_i]; } return Math.sqrt(variance_1.default.apply(void 0, __spreadArray([], __read(datapoints)))); } exports.standardDeviation = standardDeviation; exports.default = standardDeviation;