eps3.js (1683B)
1 /** 2 * @license Apache-2.0 3 * 4 * Copyright (c) 2018 The Stdlib Authors. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 'use strict'; 20 21 // MODULES // 22 23 var ln = require( './../../../../base/special/ln' ); 24 var rational1 = require( './rational_ak4bk4.js' ); 25 var rational2 = require( './rational_ak5bk5.js' ); 26 var rational3 = require( './rational_ak6bk6.js' ); 27 var rational4 = require( './rational_ak7bk7.js' ); 28 var rational5 = require( './rational_ak8bk8.js' ); 29 30 31 // MAIN // 32 33 /** 34 * Evaluates the `eps3` function. 35 * 36 * @private 37 * @param {number} eta - eta value 38 * @returns {number} function value 39 */ 40 function eps3( eta ) { 41 var x; 42 var y; 43 44 if ( eta < -8.0 ) { 45 x = eta * eta; 46 y = ln( -eta ) / eta; 47 return ( -30.0 + ( eta*y*( (6.0*x*y*y)-12.0+x ) ) ) / ( 12.0*eta*x*x ); 48 } 49 if ( eta < -4.0 ) { 50 return rational1( eta ) / ( eta*eta ); 51 } 52 if ( eta < -2.0 ) { 53 return rational2( eta ); 54 } 55 if ( eta < 2.0 ) { 56 return rational3( eta ); 57 } 58 if ( eta < 10.0 ) { 59 x = 1.0 / eta; 60 return rational4( x ) / ( eta*eta ); 61 } 62 if ( eta < 100.0 ) { 63 x = 1.0 / eta; 64 return rational5( x ) / ( eta*eta ); 65 } 66 return -ln( eta ) / ( 12.0*eta*eta*eta ); 67 } 68 69 70 // EXPORTS // 71 72 module.exports = eps3;