UNPKG

@stdlib/math-base-special-kernel-sin

Version:

Compute the sine of a double-precision floating-point number on [-π/4, π/4].

68 lines (58 loc) 1.5 kB
/** * @license Apache-2.0 * * Copyright (c) 2022 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. */ 'use strict'; // MODULES // var addon = require( './../src/addon.node' ); // MAIN // /** * Computes the sine on \\( \approx \[-\pi/4, \pi/4] \\) (except on \\(-0\\)), where \\( \pi/4 \approx 0.7854 \\). * * @private * @param {number} x - input value (in radians, assumed to be bounded by `~pi/4` in magnitude) * @param {number} y - tail of `x` * @returns {number} sine * * @example * var v = kernelSin( 0.0, 0.0 ); * // returns ~0.0 * * @example * var v = kernelSin( 3.141592653589793/6.0, 0.0 ); * // returns ~0.5 * * @example * var v = kernelSin( 0.619, 9.279e-18 ); * // returns ~0.58 * * @example * var v = kernelSin( NaN, 0.0 ); * // returns NaN * * @example * var v = kernelSin( 3.0, NaN ); * // returns NaN * * @example * var v = kernelSin( NaN, NaN ); * // returns NaN */ function kernelSin( x, y ) { return addon( x, y ); } // EXPORTS // module.exports = kernelSin;