/* This is a generated file. Do not edit directly. */

/* eslint-disable no-restricted-syntax, no-invalid-this */

/* harmony default export */

/* harmony import */

/*#__PURE__*/

/**
	* Finishes an iterator.
	*
	* @private
	* @param {*} [value] - value to return
	* @returns {Object} iterator protocol-compliant object
	*/

/**
	* Returns a new iterator.
	*
	* @private
	* @returns {Iterator} iterator
	*/

/**
	* Returns an iterator protocol-compliant object containing the next iterated value.
	*
	* @private
	* @returns {Object} iterator protocol-compliant object
	*/

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* ## Notice
*
* The following copyright and license were part of the original implementation available as part of [FreeBSD]{@link https://svnweb.freebsd.org/base/release/9.3.0/lib/msun/src/e_log10.c}. The implementation follows the original, but has been modified for JavaScript.
*
* ```text
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ```
*/

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* ## Notice
*
* The following copyright and license were part of the original implementation available as part of [FreeBSD]{@link https://svnweb.freebsd.org/base/release/9.3.0/lib/msun/src/e_log2.c}. The implementation follows the original, but has been modified for JavaScript.
*
* ```text
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ```
*/

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* ## Notice
*
* The following copyright and license were part of the original implementation available as part of [FreeBSD]{@link https://svnweb.freebsd.org/base/release/9.3.0/lib/msun/src/k_log.h}. The implementation follows the original, but has been modified for JavaScript.
*
* ```text
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ```
*/

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* ## Notice
*
* The following copyright, license, and long comment were part of the original implementation available as part of [FreeBSD]{@link https://svnweb.freebsd.org/base/release/9.3.0/lib/msun/src/e_exp.c}. The implementation follows the original, but has been modified for JavaScript.
*
* ```text
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ```
*/

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* ## Notice
*
* The following copyright, license, and long comment were part of the original implementation available as part of [FreeBSD]{@link https://svnweb.freebsd.org/base/release/9.3.0/lib/msun/src/k_tan.c}. The implementation follows the original, but has been modified for JavaScript.
*
* ```text
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ```
*/

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* ## Notice
*
* The following copyright, license, and long comment were part of the original implementation available as part of [FreeBSD]{@link https://svnweb.freebsd.org/base/release/9.3.0/lib/msun/src/s_tan.c}. The implementation follows the original, but has been modified for JavaScript.
*
* ```text
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ```
*/

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Adds a value to the stack.
*
* @name push
* @memberof Stack.prototype
* @type {Function}
* @returns {Stack} stack instance
*
* @example
* var s = new Stack();
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Remove the top value:
* var v = s.pop();
* // returns 'bar'
*
* // Add a new value to the stack:
* s.push( 'beep' );
*
* // Remove the top value:
* v = s.pop();
* // returns 'beep'
*/

/**
* Attempts to call a `RegExp` method.
*
* @private
* @param {*} value - value to test
* @returns {boolean} boolean indicating if able to call a `RegExp` method
*/

/**
* Clears the stack.
*
* @name clear
* @memberof Stack.prototype
* @type {Function}
* @returns {Stack} stack instance
*
* @example
* var s = new Stack();
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Peek at the top value:
* var v = s.first();
* // returns 'bar'
*
* // Examine the stack length:
* var len = s.length;
* // returns 2
*
* // Clear all stack items:
* s.clear();
*
* // Peek at the top value:
* v = s.first();
* // returns undefined
*
* // Examine the stack length:
* len = s.length;
* // returns 0
*/

/**
* Compute the base `b` logarithm.
*
* @module @stdlib/math/base/special/log
*
* @example
* var log = require( '@stdlib/math/base/special/log' );
*
* var v = log( 100.0, 10.0 );
* // returns 2.0
*
* v = log( 16.0, 2.0 );
* // returns 4.0
*
* v = log( 5.0, 1.0 );
* // returns Infinity
*/

/**
* Compute the multiplicative inverse.
*
* @module @stdlib/math/base/special/inv
*
* @example
* var inv = require( '@stdlib/math/base/special/inv' );
*
* var v = inv( -1.0 );
* // returns -1.0
*
* v = inv( 2.0 );
* // returns 0.5
*
* v = inv( 0.0 );
* // returns Infinity
*
* v = inv( -0.0 );
* // returns -Infinity
*
* v = inv( NaN );
* // returns NaN
*/

/**
* Compute the tangent of a number on `[-π/4, π/4]`.
*
* @module @stdlib/math/base/special/kernel-tan
*
* @example
* var kernelTan = require( '@stdlib/math/base/special/kernel-tan' );
*
* var out = kernelTan( 3.141592653589793/4.0, 0.0, 1 );
* // returns ~1.0
*
* out = kernelTan( 3.141592653589793/4.0, 0.0, -1 );
* // returns ~-1.0
*
* out = kernelTan( 3.141592653589793/6.0, 0.0, 1 );
* // returns ~0.577
*
* out = kernelTan( 0.664, 5.288e-17, 1 );
* // returns ~0.783
*/

/**
* Computes \\(e^{r} 2^k\\) where \\(r = \mathrm{hi} - \mathrm{lo}\\) and \\(|r| \leq \ln(2)/2\\).
*
* @private
* @param {number} hi - upper bound
* @param {number} lo - lower bound
* @param {integer} k - power of 2
* @returns {number} function value
*/

/**
* Computes the base `b` logarithm of `x`.
*
* @param {NonNegativeNumber} x - input value
* @param {NonNegativeNumber} b - base
* @returns {number} logarithm (base `b`)
*
* @example
* var v = log( 100.0, 10.0 );
* // returns 2.0
*
* @example
* var v = log( 16.0, 2.0 );
* // returns 4.0
*
* @example
* var v = log( 5.0, 1.0 );
* // returns Infinity
*
* @example
* var v = log( NaN, 2.0 );
* // returns NaN
*
* @example
* var v = log( 1.0, NaN );
* // returns NaN
*
* @example
* var v = log( -4.0, 2.0 );
* // returns NaN
*
* @example
* var v = log( 4.0, -2.0 );
* // returns NaN
*/

/**
* Computes the multiplicative inverse of `x`.
*
* @param {number} x - input value
* @returns {number} multiplicative inverse
*
* @example
* var v = inv( -1.0 );
* // returns -1.0
*
* @example
* var v = inv( 2.0 );
* // returns 0.5
*
* @example
* var v = inv( 0.0 );
* // returns Infinity
*
* @example
* var v = inv( -0.0 );
* // returns -Infinity
*
* @example
* var v = inv( NaN );
* // returns NaN
*/

/**
* Computes the tangent on \\( \approx\[-\pi/4, \pi/4] \\) (except on -0), \\( \pi/4 \approx 0.7854 \\).
*
* ## Method
*
* -   Since \\( \tan(-x) = -\tan(x) \\), we need only to consider positive \\( x \\).
*
* -   Callers must return \\( \tan(-0) = -0 \\) without calling here since our odd polynomial is not evaluated in a way that preserves \\( -0 \\). Callers may do the optimization \\( \tan(x) \approx x \\) for tiny \\( x \\).
*
* -   \\( \tan(x) \\) is approximated by a odd polynomial of degree 27 on \\( \[0, 0.67434] \\)
*
*     ```tex
*     \tan(x) \approx x + T_1 x^3 + \ldots + T_{13} x^{27}
*     ```
*     where
*
*     ```tex
*     \left| \frac{\tan(x)}{x} - \left( 1 + T_1 x^2 + T_2 x^4 + \ldots + T_{13} x^{26} \right) \right|  \le 2^{-59.2}
*     ```
*
* -   Note: \\( \tan(x+y) = \tan(x) + \tan'(x) \cdot y \approx \tan(x) + ( 1 + x \cdot x ) \cdot y \\). Therefore, for better accuracy in computing \\( \tan(x+y) \\), let
*
*     ```tex
*     r = x^3 \cdot \left( T_2+x^2 \cdot (T_3+x^2 \cdot (\ldots+x^2 \cdot (T_{12}+x^2 \cdot T_{13}))) \right)
*     ```
*
*     then
*
*     ```tex
*     \tan(x+y) = x^3 + \left( T_1 \cdot x^2 + (x \cdot (r+y)+y) \right)
*     ```
*
* -   For \\( x \\) in \\( \[0.67434, \pi/4] \\),  let \\( y = \pi/4 - x \\), then
*
*     ```tex
*     \tan(x) = \tan\left(\tfrac{\pi}{4}-y\right) = \frac{1-\tan(y)}{1+\tan(y)} \\
*     = 1 - 2 \cdot \left( \tan(y) - \tfrac{\tan(y)^2}{1+\tan(y)} \right)
*     ```
*
*
* @param {number} x - input value (in radians, assumed to be bounded by ~π/4 in magnitude)
* @param {number} y - tail of `x`
* @param {integer} k - indicates whether tan (if k = 1) or -1/tan (if k = -1) is returned
* @returns {number} tangent
*
* @example
* var out = kernelTan( 3.141592653589793/4.0, 0.0, 1 );
* // returns ~1.0
*
* @example
* var out = kernelTan( 3.141592653589793/4.0, 0.0, -1 );
* // returns ~-1.0
*
* @example
* var out = kernelTan( 3.141592653589793/6.0, 0.0, 1 );
* // returns ~0.577
*
* @example
* var out = kernelTan( 0.664, 5.288e-17, 1 );
* // returns ~0.783
*
* @example
* var out = kernelTan( NaN, 0.0, 1 );
* // returns NaN
*
* @example
* var out = kernelTan( 3.0, NaN, 1 );
* // returns NaN
*
* @example
* var out = kernelTan( NaN, NaN, 1 );
* // returns NaN
*/

/**
* Convert an angle from degrees to radians.
*
* @module @stdlib/math/base/special/deg2rad
*
* @example
* var deg2rad = require( '@stdlib/math/base/special/deg2rad' );
*
* var r = deg2rad( 90.0 );
* // returns ~1.571
*
* r = deg2rad( -45.0 );
* // returns ~-0.785
*
* r = deg2rad( NaN );
* // returns NaN
*/

/**
* Converts an angle from degrees to radians.
*
* @param {number} x - angle in degrees
* @returns {number} angle in radians
*
* @example
* var r = deg2rad( 90.0 );
* // returns ~1.571
*
* @example
* var r = deg2rad( -45.0 );
* // returns ~-0.785
*
* @example
* var r = deg2rad( NaN );
* // returns NaN
*/

/**
* Escape a regular expression string or pattern.
*
* @module @stdlib/utils/escape-regexp-string
*
* @example
* var rescape = require( '@stdlib/utils/escape-regexp-string' );
*
* var str = rescape( '[A-Z]*' );
* // returns '\\[A\\-Z\\]\\*'
*/

/**
* Escapes a regular expression string.
*
* @param {string} str - regular expression string
* @throws {TypeError} first argument must be a string primitive
* @returns {string} escaped string
*
* @example
* var str = rescape( '[A-Z]*' );
* // returns '\\[A\\-Z\\]\\*'
*/

/**
* Evaluate the binary logarithm (base two).
*
* @module @stdlib/math/base/special/log2
*
* @example
* var log2 = require( '@stdlib/math/base/special/log2' );
*
* var v = log2( 4.0 );
* // returns 2.0
*
* v = log2( 8.0 );
* // returns 3.0
*
* v = log2( 0.0 );
* // returns -Infinity
*
* v = log2( Infinity );
* // returns Infinity
*
* v = log2( NaN );
* // returns NaN
*
* v = log2( -4.0 );
* // returns NaN
*/

/**
* Evaluate the common logarithm (base ten).
*
* @module @stdlib/math/base/special/log10
*
* @example
* var log10 = require( '@stdlib/math/base/special/log10' );
*
* var v = log10( 100.0 );
* // returns ~0.602
*
* v = log10( 8.0 );
* // returns ~0.903
*
* v = log10( 0.0 );
* // returns -Infinity
*
* v = log10( Infinity );
* // returns Infinity
*
* v = log10( NaN );
* // returns NaN
*
* v = log10( -4.0 );
* // returns NaN
*/

/**
* Evaluate the natural exponential function.
*
* @module @stdlib/math/base/special/exp
*
* @example
* var exp = require( '@stdlib/math/base/special/exp' );
*
* var v = exp( 4.0 );
* // returns ~54.5982
*
* v = exp( -9.0 );
* // returns ~1.234e-4
*
* v = exp( 0.0 );
* // returns 1.0
*
* v = exp( NaN );
* // returns NaN
*/

/**
* Evaluate the tangent of a number.
*
* @module @stdlib/math/base/special/tan
*
* @example
* var tan = require( '@stdlib/math/base/special/tan' );
*
* var v = tan( 0.0 );
* // returns ~0.0
*
* v = tan( -3.141592653589793/4.0 );
* // returns ~-1.0
*
* v = tan( 3.141592653589793/4.0 );
* // returns ~1.0
*
* v = tan( NaN );
* // returns NaN
*/

/**
* 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
*/

/**
* Evaluates the binary logarithm (base two).
*
* @param {NonNegativeNumber} x - input value
* @returns {number} function value
*
* @example
* var v = log2( 4.0 );
* // returns 2.0
*
* @example
* var v = log2( 8.0 );
* // returns 3.0
*
* @example
* var v = log2( 0.0 );
* // returns -Infinity
*
* @example
* var v = log2( Infinity );
* // returns Infinity
*
* @example
* var v = log2( NaN );
* // returns NaN
*
* @example
* var v = log2( -4.0 );
* // returns NaN
*/

/**
* Evaluates the common logarithm (base ten).
*
* @param {NonNegativeNumber} x - input value
* @returns {number} function value
*
* @example
* var v = log10( 4.0 );
* // returns ~0.602
*
* @example
* var v = log10( 8.0 );
* // returns ~0.903
*
* @example
* var v = log10( 0.0 );
* // returns -Infinity
*
* @example
* var v = log10( Infinity );
* // returns Infinity
*
* @example
* var v = log10( NaN );
* // returns NaN
*
* @example
* var v = log10( -4.0 );
* // returns NaN
*/

/**
* Evaluates the natural exponential function.
*
* ## Method
*
* 1.  We reduce \\( x \\) to an \\( r \\) so that \\( |r| \leq 0.5 \cdot \ln(2) \approx 0.34658 \\). Given \\( x \\), we find an \\( r \\) and integer \\( k \\) such that
*
*     ```tex
*     \begin{align*}
*     x &= k \cdot \ln(2) + r \\
*     |r| &\leq 0.5 \cdot \ln(2)
*     \end{align*}
*     ```
*
*     <!-- <note> -->
*
*     \\( r \\) can be represented as \\( r = \mathrm{hi} - \mathrm{lo} \\) for better accuracy.
*
*     <!-- </note> -->
*
* 2.  We approximate of \\( e^{r} \\) by a special rational function on the interval \\(\[0,0.34658]\\):
*
*     ```tex
*     \begin{align*}
*     R\left(r^2\right) &= r \cdot \frac{ e^{r}+1 }{ e^{r}-1 } \\
*     &= 2 + \frac{r^2}{6} - \frac{r^4}{360} + \ldots
*     \end{align*}
*     ```
*
*     We use a special Remes algorithm on \\(\[0,0.34658]\\) to generate a polynomial of degree \\(5\\) to approximate \\(R\\). The maximum error of this polynomial approximation is bounded by \\(2^{-59}\\). In other words,
*
*     ```tex
*     R(z) \sim 2 + P_1 z + P_2 z^2 + P_3 z^3 + P_4 z^4 + P_5 z^5
*     ```
*
*     where \\( z = r^2 \\) and
*
*     ```tex
*     \left|  2 + P_1 z + \ldots + P_5 z^5  - R(z) \right| \leq 2^{-59}
*     ```
*
*     <!-- <note> -->
*
*     The values of \\( P_1 \\) to \\( P_5 \\) are listed in the source code.
*
*     <!-- </note> -->
*
*     The computation of \\( e^{r} \\) thus becomes
*
*     ```tex
*     \begin{align*}
*     e^{r} &= 1 + \frac{2r}{R-r} \\
*           &= 1 + r + \frac{r \cdot R_1(r)}{2 - R_1(r)}\ \text{for better accuracy}
*     \end{align*}
*     ```
*
*     where
*
*     ```tex
*     R_1(r) = r - P_1\ r^2 + P_2\ r^4 + \ldots + P_5\ r^{10}
*     ```
*
* 3.  We scale back to obtain \\( e^{x} \\). From step 1, we have
*
*     ```tex
*     e^{x} = 2^k e^{r}
*     ```
*
*
* ## Special Cases
*
* ```tex
* \begin{align*}
* e^\infty &= \infty \\
* e^{-\infty} &= 0 \\
* e^{\mathrm{NaN}} &= \mathrm{NaN} \\
* e^0 &= 1\ \mathrm{is\ exact\ for\ finite\ argument\ only}
* \end{align*}
* ```
*
* ## Notes
*
* -   According to an error analysis, the error is always less than \\(1\\) ulp (unit in the last place).
*
* -   For an IEEE double,
*
*     -   if \\(x > 7.09782712893383973096\mbox{e+}02\\), then \\(e^{x}\\) overflows
*     -   if \\(x < -7.45133219101941108420\mbox{e+}02\\), then \\(e^{x}\\) underflows
*
* -   The hexadecimal values included in the source code are the intended ones for the used constants. Decimal values may be used, provided that the compiler will convert from decimal to binary accurately enough to produce the intended hexadecimal values.
*
*
* @param {number} x - input value
* @returns {number} function value
*
* @example
* var v = exp( 4.0 );
* // returns ~54.5982
*
* @example
* var v = exp( -9.0 );
* // returns ~1.234e-4
*
* @example
* var v = exp( 0.0 );
* // returns 1.0
*
* @example
* var v = exp( NaN );
* // returns NaN
*/

/**
* Evaluates the tangent of a number.
*
* ## Method
*
* -   Let \\(S\\), \\(C\\), and \\(T\\) denote the \\(\sin\\), \\(\cos\\), and \\(\tan\\), respectively, on \\(\[-\pi/4, +\pi/4\]\\).
*
* -   Reduce the argument \\(x\\) to \\(y1+y2 = x-k\pi/2\\) in \\(\[-\pi/4, +\pi/4\]\\), and let \\(n = k \mod 4\\).
*
* -   We have
*
*     | n | sin(x) | cos(x) | tan(x) |
*     | - | ------ | ------ | ------ |
*     | 0 |    S   |    C   |   T    |
*     | 1 |    C   |   -S   |  -1/T  |
*     | 2 |   -S   |   -C   |   T    |
*     | 3 |   -C   |    S   |  -1/T  |
*
*
* @param {number} x - input value (in radians)
* @returns {number} tangent
*
* @example
* var v = tan( 0.0 );
* // returns ~0.0
*
* @example
* var v = tan( -3.141592653589793/4.0 );
* // returns ~-1.0
*
* @example
* var v = tan( 3.141592653589793/4.0 );
* // returns ~1.0
*
* @example
* var v = tan( NaN );
* // returns NaN
*/

/**
* Iterator symbol.
*
* @module @stdlib/symbol/iterator
*
* @example
* var IteratorSymbol = require( '@stdlib/symbol/iterator' );
*
* function iterator() {
*     var it;
*     var i;
*
*     i = -1;
*
*     it = {};
*     it.next = next;
*     it.return = done;
*
*     if ( IteratorSymbol ) {
*         it[ IteratorSymbol ] = iterator;
*     }
*     return it;
*
*     function next() {
*         i += 1;
*         return {
*             'value': i,
*             'done': false
*         };
*     }
*
*     function done( value ) {
*         if ( arguments.length === 0 ) {
*             return {
*                 'done': true
*             };
*         }
*         return {
*             'value': value,
*             'done': true
*         };
*     }
* }
*
* var obj = iterator();
*/

/**
* Iterator symbol.
*
* @name IteratorSymbol
* @constant
* @type {(symbol|null)}
*
* @example
* function iterator() {
*     var it;
*     var i;
*
*     i = -1;
*
*     it = {};
*     it.next = next;
*     it.return = done;
*
*     if ( IteratorSymbol ) {
*         it[ IteratorSymbol ] = iterator;
*     }
*     return it;
*
*     function next() {
*         i += 1;
*         return {
*             'value': i,
*             'done': false
*         };
*     }
*
*     function done( value ) {
*         if ( arguments.length === 0 ) {
*             return {
*                 'done': true
*             };
*         }
*         return {
*             'value': value,
*             'done': true
*         };
*     }
* }
*
* var obj = iterator();
*/

/**
* Removes a value from the stack.
*
* @name pop
* @memberof Stack.prototype
* @type {Function}
* @returns {(*|void)} removed value
*
* @example
* var s = new Stack();
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Remove the top value:
* var v = s.pop();
* // returns 'bar'
*
* // Add a new value to the stack:
* s.push( 'beep' );
*
* // Remove the top value:
* v = s.pop();
* // returns 'beep'
*/

/**
* Replace search occurrences with a replacement string.
*
* @module @stdlib/string/replace
*
* @example
* var replace = require( '@stdlib/string/replace' );
*
* var str = 'beep';
* var out = replace( str, 'e', 'o' );
* // returns 'boop'
*
* str = 'Hello World';
* out = replace( str, /world/i, 'Mr. President' );
* // returns 'Hello Mr. President'
*/

/**
* Replace search occurrences with a replacement string.
*
* @param {string} str - input string
* @param {(string|RegExp)} search - search expression
* @param {(string|Function)} newval - replacement value or function
* @throws {TypeError} first argument must be a string primitive
* @throws {TypeError} second argument argument must be a string primitive or regular expression
* @throws {TypeError} third argument must be a string primitive or function
* @returns {string} new string containing replacement(s)
*
* @example
* var str = 'beep';
* var out = replace( str, 'e', 'o' );
* // returns 'boop'
*
* @example
* var str = 'Hello World';
* var out = replace( str, /world/i, 'Mr. President' );
* // returns 'Hello Mr. President'
*
* @example
* var capitalize = require( '@stdlib/string/capitalize' );
*
* var str = 'Oranges and lemons say the bells of St. Clement\'s';
*
* function replacer( match, p1 ) {
*     return capitalize( p1 );
* }
*
* var out = replace( str, /([^\s]*)/gi, replacer);
* // returns 'Oranges And Lemons Say The Bells Of St. Clement\'s'
*/

/**
* Return `log(x) - (x-1)` for `x` in `~[sqrt(2)/2, sqrt(2)]`.
*
* @private
* @param {number} x - input value
* @returns {number} function value
*/

/**
* Returns an array of stack values.
*
* ## Notes
*
* -   Why reverse insertion order? Pros and cons to either order, but reverse insertion order mirrors iterator order. For example, we can use the ES6/ES2015+ spread operator along with the iterator to return stack values.
*
*     ```text
*     arr = [...s.iterator()]
*     ```
*
*     One might (as is the opinion here) consider parity of array serialization and iterator order to be a reasonable design goal.
*
* @name toArray
* @memberof Stack.prototype
* @type {Function}
* @returns {Array} stack values
*
* @example
* var s = new Stack();
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Get an array of stack values:
* var vals = s.toArray();
* // returns [ 'bar', 'foo' ]
*/

/**
* Returns an iterator for iterating over a stack.
*
* ## Notes
*
* -   In order to prevent confusion arising from stack mutation during iteration, a returned iterator **always** iterates over a stack "snapshot", which is defined as the list of stack elements at the time of this method's invocation.
*
* @name iterator
* @memberof Stack.prototype
* @type {Function}
* @returns {Iterator} iterator
*
* @example
* var s = new Stack();
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Create an iterator:
* var it = s.iterator();
*
* // Iterate over the stack...
* var v = it.next().value;
* // returns 'bar'
*
* v = it.next().value;
* // returns 'foo'
*
* var bool = it.next().done;
* // returns true
*/

/**
* Returns the bottom stack value (i.e., the value which is currently "last-out").
*
* @name last
* @memberof Stack.prototype
* @type {Function}
* @returns {(*|void)} bottom stack value
*
* @example
* var s = new Stack();
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Peek at the bottom value:
* var v = s.last();
* // returns 'foo'
*/

/**
* Returns the top value (i.e., the value which is "first-out").
*
* @name first
* @memberof Stack.prototype
* @type {Function}
* @returns {(*|void)} top value
*
* @example
* var s = new Stack();
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Peek at the top value:
* var v = s.first();
* // returns 'bar'
*/

/**
* Round a numeric value toward positive infinity.
*
* @module @stdlib/math/base/special/ceil
*
* @example
* var ceil = require( '@stdlib/math/base/special/ceil' );
*
* var v = ceil( -4.2 );
* // returns -4.0
*
* v = ceil( 9.99999 );
* // returns 10.0
*
* v = ceil( 0.0 );
* // returns 0.0
*
* v = ceil( NaN );
* // returns NaN
*/

/**
* Round a numeric value toward zero.
*
* @module @stdlib/math/base/special/trunc
*
* @example
* var trunc = require( '@stdlib/math/base/special/trunc' );
*
* var v = trunc( -4.2 );
* // returns -4.0
*
* v = trunc( 9.99999 );
* // returns 9.0
*
* v = trunc( 0.0 );
* // returns 0.0
*
* v = trunc( -0.0 );
* // returns -0.0
*
* v = trunc( NaN );
* // returns NaN
*
* v = trunc( Infinity );
* // returns Infinity
*
* v = trunc( -Infinity );
* // returns -Infinity
*/

/**
* Rounds a numeric value toward positive infinity.
*
* @param {number} x - input value
* @returns {number} rounded value
*
* @example
* var v = ceil( -4.2 );
* // returns -4.0
*
* @example
* var v = ceil( 9.99999 );
* // returns 10.0
*
* @example
* var v = ceil( 0.0 );
* // returns 0.0
*
* @example
* var v = ceil( NaN );
* // returns NaN
*/

/**
* Rounds a numeric value toward zero.
*
* @param {number} x - input value
* @returns {number} rounded value
*
* @example
* var v = trunc( -4.2 );
* // returns -4.0
*
* @example
* var v = trunc( 9.99999 );
* // returns 9.0
*
* @example
* var v = trunc( 0.0 );
* // returns 0.0
*
* @example
* var v = trunc( -0.0 );
* // returns -0.0
*
* @example
* var v = trunc( NaN );
* // returns NaN
*
* @example
* var v = trunc( Infinity );
* // returns Infinity
*
* @example
* var v = trunc( -Infinity );
* // returns -Infinity
*/

/**
* Serializes a stack as JSON.
*
* ## Notes
*
* -   `JSON.stringify()` implicitly calls this method when stringifying a `Stack` instance.
*
* @name toJSON
* @memberof Stack.prototype
* @type {Function}
* @returns {Object} serialized stack
*
* @example
* var s = new Stack();
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Serialize to JSON:
* var o = s.toJSON();
* // returns { 'type': 'stack', 'data': [ 'bar', 'foo' ] }
*/

/**
* Stack constructor.
*
* @constructor
* @returns {Stack} stack instance
*
* @example
* var s = new Stack();
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Remove the top value:
* var v = s.pop();
* // returns 'bar'
*
* // Add a new value to the stack:
* s.push( 'beep' );
*
* // Remove the top value:
* v = s.pop();
* // returns 'beep'
*/

/**
* Stack length.
*
* @name length
* @memberof Stack.prototype
* @type {NonNegativeInteger}
*
* @example
* var s = new Stack();
*
* // Examine the initial stack length:
* var len = s.length;
* // returns 0
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Retrieve the current stack length:
* len = s.length;
* // returns 2
*/

/**
* Stack.
*
* @module @stdlib/utils/stack
*
* @example
* var stack = require( '@stdlib/utils/stack' );
*
* var s = stack();
*
* // Add values to the stack:
* s.push( 'foo' ).push( 'bar' );
*
* // Remove the top value:
* var v = s.pop();
* // returns 'bar'
*
* // Add a new value to the stack:
* s.push( 'beep' );
*
* // Remove the top value:
* v = s.pop();
* // returns 'beep'
*/

/**
* Test for native `Symbol.iterator` support.
*
* @module @stdlib/assert/has-iterator-symbol-support
*
* @example
* var hasIteratorSymbolSupport = require( '@stdlib/assert/has-iterator-symbol-support' );
*
* var bool = hasIteratorSymbolSupport();
* // returns <boolean>
*/

/**
* Test if a string starts with the characters of another string.
*
* @module @stdlib/string/starts-with
*
* @example
* var startsWith = require( '@stdlib/string/starts-with' );
*
* var str = 'Fair is foul, and foul is fair, hover through fog and filthy air';
* var bool = startsWith( str, 'Fair' );
* // returns true
*
* bool = startsWith( str, 'fair' );
* // returns false
*
* bool = startsWith( str, 'foul', 8 );
* // returns true
*
* bool = startsWith( str, 'filthy', -10 );
* // returns true
*/

/**
* Test if a value is a regular expression.
*
* @module @stdlib/assert/is-regexp
*
* @example
* var isRegExp = require( '@stdlib/assert/is-regexp' );
*
* var bool = isRegExp( /\.+/ );
* // returns true
*
* bool = isRegExp( {} );
* // returns false
*/

/**
* Test whether a string contains only numeric digits.
*
* @module @stdlib/assert/is-digit-string
*
* @example
* var isDigitString = require( '@stdlib/assert/is-digit-string' );
*
* var out = isDigitString( '0123456789' );
* // returns true
*
* out = isDigitString( '0xffffff' );
* // returns false
*
* out = isDigitString( '' );
* // returns false
*/

/**
* Tests for native `Symbol.iterator` support.
*
* @returns {boolean} boolean indicating if an environment has `Symbol.iterator` support
*
* @example
* var bool = hasIteratorSymbolSupport();
* // returns <boolean>
*/

/**
* Tests if a string starts with the characters of another string.
*
* @param {string} str - input string
* @param {string} search - search string
* @param {integer} [position=0] - position at which to start searching
* @throws {TypeError} first argument must be a string primitive
* @throws {TypeError} second argument must be a string primitive
* @throws {TypeError} third argument must be an integer
* @returns {boolean} boolean indicating if the input string starts with the search string
*
* @example
* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember' );
* // returns true
*
* @example
* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember' );
* // returns false
*
* @example
* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be' );
* // returns true
*
* @example
* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be' );
* // returns false
*
* @example
* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 );
* // returns true
*
* @example
* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 );
* // returns true
*/

/**
* Tests if a value is a regular expression.
*
* @param {*} value - value to test
* @returns {boolean} boolean indicating whether value is a regular expression
*
* @example
* var bool = isRegExp( /\.+/ );
* // returns true
*
* @example
* var bool = isRegExp( {} );
* // returns false
*/

/**
* Tests whether a string contains only numeric digits.
*
* @param {*} x - value to test
* @returns {boolean} boolean indicating if a string contains only numeric digits
*
* @example
* var out = isDigitString( '0123456789' );
* // returns true
*
* @example
* var out = isDigitString( '0xffffff' );
* // returns false
*
* @example
* var out = isDigitString( '' );
* // returns false
*
* @example
* var out = isDigitString( 123 );
* // returns false
*/

/***/

// .toUpperCase handles XHTML

// Argument reduction needed...

// Break x^5*(T[1]+x^2*T[2]+...) into x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + x^5(x^2*(T[2]+x^4*T[4]+...+x^22*T[12]))...

// Bypass onClick if it was present

// Case: -2**-20 <= f < 2**-20

// Case: 0 < x < 2**-1022

// Case: tan(Inf or NaN) is NaN

// Case: x < 2**-1022

// Case: |x| < 2**-27

// Case: |x| >= 0.6744

// Case: |x| ~< π/4

// Character codes:

// Check if the string starts with a forward slash...

// Compute -1/(x+r) accurately...

// Create a copy of stack values (necessary in order to "snapshot" the stack; otherwise, values could come and go between calls to `next`):

// Create an iterator protocol-compliant object:

// EXPORTS //

// High word of |x|:

// IE 11

// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:

// Initialize the iteration index:

// MAIN //

// MODULES //

// Normalize `x` or `x/2`...

// Normalize x or x/2...

// Only escape the characters between the `/`:

// Reassemble:

// Reduce and compute `r = hi - lo` for extra precision.

// Subnormal number, scale up `x`...

// Subnormal number, scale up x:

// TODO: implementation (?)

// Use a dynamic array as insertion and deletion is O(1) amortized:

// VARIABLES //

// WARNING: not thread safe

// We need to de-construct the string...

// a = -1/w

// all other browsers

// asm type annotation

// do not inherit user-select (it may be `none`)

// eslint-disable-line no-unused-vars

// eslint-disable-line no-useless-escape

// eslint-disable-line stdlib/no-builtin-math

// non-generic

// prevents scrolling to the end of the page

// reset user styles for span element

// used to preserve spaces and line breaks

// z + v = r + x

// π / 180.0
