File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
lib/node_modules/@stdlib/math/base/special/cosc Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 2323#include <time.h>
2424#include <sys/time.h>
2525
26- #define NAME "cosc "
26+ #define NAME "sinc_derivative "
2727#define ITERATIONS 1000000
2828#define REPEATS 3
2929
30+ double sinc_derivative (double x ) {
31+ if ( x == 0.0 ) {
32+ return 0.0 ;
33+ }
34+ return (cos ( x ) * x - sin ( x ) ) / ( x * x );
35+ }
36+
3037/**
3138* Prints the TAP version.
3239*/
@@ -99,7 +106,7 @@ static double benchmark( void ) {
99106 t = tic ();
100107 for ( i = 0 ; i < ITERATIONS ; i ++ ) {
101108 x = ( 2.0 * rand_double () ) - 2.0 ;
102- y = stdlib_base_cosc ( x );
109+ y = sinc_derivative ( x );
103110 if ( y != y ) {
104111 printf ( "should not return NaN\n" );
105112 break ;
Original file line number Diff line number Diff line change 2121// MODULES //
2222
2323var sinpi = require ( '@stdlib/math/base/special/sinpi' ) ;
24- var cospi = require ( '@stdlib/math/base/special/cospi' ) ;
24+ var cospi = require ( '@stdlib/math/base/special/cospi' ) ;
2525var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
2626var isInfinite = require ( '@stdlib/math/base/assert/is-infinite' ) ;
2727var PI = require ( '@stdlib/constants/float64/pi' ) ;
@@ -80,7 +80,7 @@ function cosc( x ) {
8080 if ( x === 0.0 ) {
8181 return 0.0 ;
8282 }
83- return ( cospi ( x ) - ( sinpi ( x ) / ( PI * x ) ) ) / x ;
83+ return ( cospi ( x ) - ( sinpi ( x ) / ( PI * x ) ) ) / x ;
8484}
8585
8686
You can’t perform that action at this time.
0 commit comments