README.md (3240B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # Kernel Sine 22 23 > Compute the [sine][sine] of a number on `[-π/4, π/4]`. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var kernelSin = require( '@stdlib/math/base/special/kernel-sin' ); 31 ``` 32 33 #### kernelSin( x, y ) 34 35 Computes the [sine][sine] of a `number` on `[-π/4, π/4]`. For increased accuracy, the number for which the [sine][sine] should be evaluated can be supplied as a [double-double number][double-double-arithmetic] (i.e., a non-evaluated sum of two [double-precision floating-point numbers][ieee754] `x` and `y`). 36 37 ```javascript 38 var v = kernelSin( 0.0, 0.0 ); 39 // returns ~0.0 40 41 v = kernelSin( 3.141592653589793/6.0, 0.0 ); 42 // returns ~0.5 43 44 v = kernelSin( 0.619, 9.279e-18 ); 45 // returns ~0.58 46 47 v = kernelSin( NaN, 0.0 ); 48 // returns NaN 49 50 v = kernelSin( 3.0, NaN ); 51 // returns NaN 52 53 v = kernelSin( NaN, NaN ); 54 // returns NaN 55 ``` 56 57 </section> 58 59 <!-- /.usage --> 60 61 <section class="notes"> 62 63 ## Notes 64 65 - As components of a [double-double number][double-double-arithmetic], the two [double-precision floating-point numbers][ieee754] `x` and `y` must satisfy 66 67 <!-- <equation class="equation" label="eq:double_double_inequality" align="center" raw="|y| \leq \frac{1}{2} \operatorname{ulp}(x)" alt="Inequality for the two components of a double-double number."> --> 68 69 <div class="equation" align="center" data-raw-text="|y| \leq \frac{1}{2} \operatorname{ulp}(x)" data-equation="eq:double_double_inequality"> 70 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/kernel-sin/docs/img/equation_double_double_inequality.svg" alt="Inequality for the two components of a double-double number."> 71 <br> 72 </div> 73 74 <!-- </equation> --> 75 76 where `ulp` stands for [units in the last place][ulp]. 77 78 </section> 79 80 <!-- /.notes --> 81 82 <section class="examples"> 83 84 ## Examples 85 86 <!-- eslint no-undef: "error" --> 87 88 ```javascript 89 var linspace = require( '@stdlib/array/linspace' ); 90 var PI = require( '@stdlib/constants/float64/pi' ); 91 var kernelSin = require( '@stdlib/math/base/special/kernel-sin' ); 92 93 var x = linspace( -PI/4.0, PI/4.0, 100 ); 94 var i; 95 96 for ( i = 0; i < x.length; i++ ) { 97 console.log( 'kernelSin(%d) = %d', x[ i ], kernelSin( x[ i ], 0.0 ) ); 98 } 99 ``` 100 101 </section> 102 103 <!-- /.examples --> 104 105 <section class="links"> 106 107 [sine]: https://en.wikipedia.org/wiki/Sine 108 109 [double-double-arithmetic]: https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format#Double-double_arithmetic 110 111 [ieee754]: https://en.wikipedia.org/wiki/IEEE_floating_point 112 113 [ulp]: https://en.wikipedia.org/wiki/Unit_in_the_last_place 114 115 </section> 116 117 <!-- /.links -->