'use strict'; // MAIN // /** * Evaluates a polynomial. * * ## Notes * * - The implementation uses [Horner's rule][horners-method] for efficient computation. * * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method * * * @private * @param {number} x - value at which to evaluate the polynomial * @returns {number} evaluated polynomial */ function evalpoly( x ) { if ( x === 0.0 ) { return 1.0; } return 1.0 + (x * (2.5 + (x * (3.14 + (x * (-1.0 + (x * (5.0 + (x * (2.0 + (x * (3.5 + (x * (8.0 + (x * (4.2 + (x * 1.0))))))))))))))))); // eslint-disable-line max-len } // EXPORTS // module.exports = evalpoly;