You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Licensed under the Apache License, Version 2.0 (the "License");
270
+
* you may not use this file except in compliance with the License.
271
+
* You may obtain a copy of the License at
272
+
*
273
+
* http://www.apache.org/licenses/LICENSE-2.0
274
+
*
275
+
* Unless required by applicable law or agreed to in writing, software
276
+
* distributed under the License is distributed on an "AS IS" BASIS,
277
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
278
+
* See the License for the specific language governing permissions and
279
+
* limitations under the License.
280
+
*
281
+
*
282
+
* ## Notice
283
+
*
284
+
* The following copyrights, licenses, and long comment were part of the original implementation available as part of [Go]{@link https://github.com/golang/go/blob/cb07765045aed5104a3df31507564ac99e6ddce8/src/math/exp.go}, which in turn was based on an 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.
285
+
*
286
+
* ```text
287
+
* Copyright (c) 2009 The Go Authors. All rights reserved.
288
+
*
289
+
* Redistribution and use in source and binary forms, with or without
290
+
* modification, are permitted provided that the following conditions are
291
+
* met:
292
+
*
293
+
* * Redistributions of source code must retain the above copyright
294
+
* notice, this list of conditions and the following disclaimer.
295
+
* * Redistributions in binary form must reproduce the above
296
+
* copyright notice, this list of conditions and the following disclaimer
297
+
* in the documentation and/or other materials provided with the
298
+
* distribution.
299
+
* * Neither the name of Google Inc. nor the names of its
300
+
* contributors may be used to endorse or promote products derived from
301
+
* this software without specific prior written permission.
302
+
*
303
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
304
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
305
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
306
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
307
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
308
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
309
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
310
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
311
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
312
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
313
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
314
+
* ```
315
+
*
316
+
* ```text
317
+
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
318
+
*
319
+
* Developed at SunPro, a Sun Microsystems, Inc. business.
320
+
* Permission to use, copy, modify, and distribute this
321
+
* software is freely granted, provided that this notice
322
+
* is preserved.
323
+
* ```
324
+
*/
325
+
326
+
'use strict';
327
+
328
+
// MODULES //
329
+
330
+
var ldexp = require( '@stdlib/math/base/special/ldexp' );
331
+
var polyvalP = require( './polyval_p.js' );
332
+
333
+
334
+
// MAIN //
335
+
336
+
/**
337
+
* Computes \\(e^{r} 2^k\\) where \\(r = \mathrm{hi} - \mathrm{lo}\\) and \\(|r| \leq \ln(2)/2\\).
338
+
*
339
+
* @private
340
+
* @param {number} hi - upper bound
341
+
* @param {number} lo - lower bound
342
+
* @param {integer} k - power of 2
343
+
* @returns {number} function value
344
+
*/
345
+
function expmulti( hi, lo, k ) {
346
+
var r;
347
+
var t;
348
+
var c;
349
+
var y;
350
+
351
+
r = hi - lo;
352
+
t = r * r;
353
+
c = r - ( t*polyvalP( t ) );
354
+
y = 1.0 - ( lo - ( (r*c)/(2.0-c) ) - hi );
355
+
356
+
return ldexp( y, k );
357
+
}
358
+
359
+
360
+
// EXPORTS //
361
+
362
+
module.exports = expmulti;
363
+
</pre></td></tr></table></pre>
364
+
365
+
<divclass='push'></div><!-- for sticky footer -->
366
+
</div><!-- /wrapper -->
367
+
<divclass='footer quiet pad2 space-top1 center small'>
0 commit comments