File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
lib/node_modules/@stdlib/math/base/special/cosc/benchmark Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 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 bench = require ( '@stdlib/bench' ) ;
24+ var randu = require ( '@stdlib/random/base/randu' ) ;
25+ var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
26+ var pkg = require ( './../package.json' ) . name ;
27+ var cosc = require ( './../lib' ) ;
28+
29+
30+ // MAIN //
31+
32+ bench ( pkg , function benchmark ( b ) {
33+ var x ;
34+ var y ;
35+ var i ;
36+
37+ b . tic ( ) ;
38+ for ( i = 0 ; i < b . iterations ; i ++ ) {
39+ x = ( randu ( ) * 2.0 ) - 2.0 ;
40+ y = cosc ( x ) ;
41+ if ( isnan ( y ) ) {
42+ b . fail ( 'should not return NaN' ) ;
43+ }
44+ }
45+ b . toc ( ) ;
46+ if ( isnan ( y ) ) {
47+ b . fail ( 'should not return NaN' ) ;
48+ }
49+ b . pass ( 'benchmark finished' ) ;
50+ b . end ( ) ;
51+ } ) ;
You can’t perform that action at this time.
0 commit comments