Skip to content

Commit 3c5f7ec

Browse files
committed
Auto-generated commit
1 parent bf4bb66 commit 3c5f7ec

File tree

19 files changed

+1275
-2
lines changed

19 files changed

+1275
-2
lines changed

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ shrinkwrap = false
2626

2727
# Disable automatically "saving" dependencies on install:
2828
save = false
29+
30+
# Generate provenance metadata:
31+
provenance = true

CONTRIBUTORS

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
#
33
# Contributors listed in alphabetical order.
44

5+
Adarsh Palaskar <83298237+adarshpalaskar1@users.noreply.github.com>
56
Aditya Sapra <110766802+adityacodes30@users.noreply.github.com>
67
AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com>
78
Ali Salesi <ali_sal1381@yahoo.com>
9+
Aman Bhansali <92033532+aman-095@users.noreply.github.com>
810
Amit Jimiwal <amitjimiwal45@gmail.com>
11+
Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com>
912
Athan Reines <kgryte@gmail.com>
1013
Brendan Graetz <bguiz@users.noreply.github.com>
1114
Bruno Fenzl <brunofenzl@gmail.com>
@@ -15,10 +18,12 @@ Dan Rose <danoftheroses@gmail.com>
1518
Daniel Killenberger <daniel.killenberger@gmail.com>
1619
Dominik Moritz <domoritz@gmail.com>
1720
Dorrin Sotoudeh <dorrinsotoudeh123@gmail.com>
21+
EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>
1822
Frank Kovacs <fran70kk@gmail.com>
1923
GUNJ JOSHI <gunjjoshi8372@gmail.com>
2024
Golden <103646877+AuenKr@users.noreply.github.com>
2125
Harshita Kalani <harshitakalani02@gmail.com>
26+
Jaimin Godhani <112328542+Jai0401@users.noreply.github.com>
2227
James Gelok <jdgelok@gmail.com>
2328
Jaysukh Makvana <jaysukhmakvana2004@gmail.com>
2429
Jithin KS <jithinks112@gmail.com>
@@ -28,6 +33,8 @@ Joris Labie <joris.labie1@gmail.com>
2833
Justin Dennison <justin1dennison@gmail.com>
2934
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
3035
Khaldon <kahmd1444@gmail.com>
36+
Lovelin <100030865+lovelindhoni@users.noreply.github.com>
37+
Manik Sharma <maniksharma.rke@gmail.com>
3138
Marcus Fantham <mfantham@users.noreply.github.com>
3239
Matt Cochrane <matthew.cochrane.eng@gmail.com>
3340
Mihir Pandit <129577900+MSP20086@users.noreply.github.com>
@@ -36,22 +43,31 @@ Momtchil Momtchev <momtchil@momtchev.com>
3643
Naresh Jagadeesan <naresh.naresh000@gmail.com>
3744
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
3845
Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com>
46+
Oneday12323 <107678750+Oneday12323@users.noreply.github.com>
3947
Philipp Burckhardt <pburckhardt@outlook.com>
4048
Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
4149
Pranav Goswami <goswami.4@iitj.ac.in>
4250
Praneki <97080887+PraneGIT@users.noreply.github.com>
4351
Pratik <97464067+Pratik772846@users.noreply.github.com>
52+
Priyansh <88396544+itsspriyansh@users.noreply.github.com>
53+
Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com>
4454
Ricky Reusser <rsreusser@gmail.com>
4555
Robert Gislason <gztown2216@yahoo.com>
4656
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
4757
Rutam <138517416+performant23@users.noreply.github.com>
4858
Ryan Seal <splrk@users.noreply.github.com>
59+
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
4960
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
61+
Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com>
5062
Shraddheya Shendre <shendreshraddheya@gmail.com>
5163
Shubham <shubh622005@gmail.com>
5264
Snehil Shah <130062020+Snehil-Shah@users.noreply.github.com>
5365
Spandan Barve <114365550+marsian83@users.noreply.github.com>
5466
Stephannie Jiménez Gacha <steff456@hotmail.com>
67+
Utkarsh <137638507+Ut-the-pro@users.noreply.github.com>
5568
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
69+
nishant-s7 <97207366+nishant-s7@users.noreply.github.com>
5670
orimiles5 <97595296+orimiles5@users.noreply.github.com>
5771
rei2hu <reimu@reimu.ws>
72+
utkarsh_raj <49344502+rajutkarsh07@users.noreply.github.com>
73+
vr-varad <114755221+vr-varad@users.noreply.github.com>

README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,97 @@ bool = isNegativeInteger( NaN );
133133

134134
<!-- /.examples -->
135135

136+
<!-- C interface documentation. -->
137+
138+
* * *
139+
140+
<section class="c">
141+
142+
## C APIs
143+
144+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
145+
146+
<section class="intro">
147+
148+
</section>
149+
150+
<!-- /.intro -->
151+
152+
<!-- C usage documentation. -->
153+
154+
<section class="usage">
155+
156+
### Usage
157+
158+
```c
159+
#include "stdlib/math/base/assert/is_negative_integer.h"
160+
```
161+
162+
#### stdlib_base_is_negative_integer( x )
163+
164+
Tests if a finite [double-precision floating-point number][ieee754] is a negative integer.
165+
166+
```c
167+
#include <stdbool.h>
168+
169+
bool out = stdlib_base_is_negative_integer( -4.0 );
170+
// returns true
171+
172+
out = stdlib_base_is_negative_integer( 3.0 );
173+
// returns false
174+
```
175+
176+
The function accepts the following arguments:
177+
178+
- **x**: `[in] double` input value.
179+
180+
```c
181+
bool stdlib_base_is_negative_integer( const double x );
182+
```
183+
184+
</section>
185+
186+
<!-- /.usage -->
187+
188+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
189+
190+
<section class="notes">
191+
192+
</section>
193+
194+
<!-- /.notes -->
195+
196+
<!-- C API usage examples. -->
197+
198+
<section class="examples">
199+
200+
### Examples
201+
202+
```c
203+
#include "stdlib/math/base/assert/is_negative_integer.h"
204+
#include <stdio.h>
205+
#include <stdbool.h>
206+
207+
int main( void ) {
208+
const double x[] = { 5.0, -5.0, 3.14, -3.14, 0.0, 0.0/0.0 };
209+
210+
bool b;
211+
int i;
212+
for ( i = 0; i < 6; i++ ) {
213+
b = stdlib_base_is_negative_integer( x[ i ] );
214+
printf( "Value: %lf. Is negative integer? %s.\n", x[ i ], ( b ) ? "True" : "False" );
215+
}
216+
}
217+
```
218+
219+
</section>
220+
221+
<!-- /.examples -->
222+
223+
</section>
224+
225+
<!-- /.c -->
226+
136227
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
137228
138229
<section class="related">

benchmark/benchmark.native.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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 resolve = require( 'path' ).resolve;
24+
var bench = require( '@stdlib/bench-harness' );
25+
var randu = require( '@stdlib/random-base-randu' );
26+
var round = require( '@stdlib/math-base-special-round' );
27+
var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
28+
var tryRequire = require( '@stdlib/utils-try-require' );
29+
var pkg = require( './../package.json' ).name;
30+
31+
32+
// VARIABLES //
33+
34+
var isNegativeInteger = tryRequire( resolve( __dirname, './../lib/native.js' ) );
35+
var opts = {
36+
'skip': ( isNegativeInteger instanceof Error )
37+
};
38+
39+
40+
// MAIN //
41+
42+
bench( pkg+'::native', opts, function benchmark( b ) {
43+
var x;
44+
var y;
45+
var i;
46+
47+
b.tic();
48+
for ( i = 0; i < b.iterations; i++ ) {
49+
x = round( (randu()*1.0e7) - 5.0e6 );
50+
y = isNegativeInteger( x );
51+
if ( typeof y !== 'boolean' ) {
52+
b.fail( 'should return a boolean' );
53+
}
54+
}
55+
b.toc();
56+
if ( !isBoolean( y ) ) {
57+
b.fail( 'should return a boolean' );
58+
}
59+
b.pass( 'benchmark finished' );
60+
b.end();
61+
});

benchmark/c/native/Makefile

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2024 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+
# VARIABLES #
20+
21+
ifndef VERBOSE
22+
QUIET := @
23+
else
24+
QUIET :=
25+
endif
26+
27+
# Determine the OS ([1][1], [2][2]).
28+
#
29+
# [1]: https://en.wikipedia.org/wiki/Uname#Examples
30+
# [2]: http://stackoverflow.com/a/27776822/2225624
31+
OS ?= $(shell uname)
32+
ifneq (, $(findstring MINGW,$(OS)))
33+
OS := WINNT
34+
else
35+
ifneq (, $(findstring MSYS,$(OS)))
36+
OS := WINNT
37+
else
38+
ifneq (, $(findstring CYGWIN,$(OS)))
39+
OS := WINNT
40+
else
41+
ifneq (, $(findstring Windows_NT,$(OS)))
42+
OS := WINNT
43+
endif
44+
endif
45+
endif
46+
endif
47+
48+
# Define the program used for compiling C source files:
49+
ifdef C_COMPILER
50+
CC := $(C_COMPILER)
51+
else
52+
CC := gcc
53+
endif
54+
55+
# Define the command-line options when compiling C files:
56+
CFLAGS ?= \
57+
-std=c99 \
58+
-O3 \
59+
-Wall \
60+
-pedantic
61+
62+
# Determine whether to generate position independent code ([1][1], [2][2]).
63+
#
64+
# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
65+
# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option
66+
ifeq ($(OS), WINNT)
67+
fPIC ?=
68+
else
69+
fPIC ?= -fPIC
70+
endif
71+
72+
# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
73+
INCLUDE ?=
74+
75+
# List of source files:
76+
SOURCE_FILES ?=
77+
78+
# List of libraries (e.g., `-lopenblas -lpthread`):
79+
LIBRARIES ?=
80+
81+
# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
82+
LIBPATH ?=
83+
84+
# List of C targets:
85+
c_targets := benchmark.out
86+
87+
88+
# RULES #
89+
90+
#/
91+
# Compiles source files.
92+
#
93+
# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
94+
# @param {string} [CFLAGS] - C compiler options
95+
# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
96+
# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`)
97+
# @param {string} [SOURCE_FILES] - list of source files
98+
# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
99+
# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`)
100+
#
101+
# @example
102+
# make
103+
#
104+
# @example
105+
# make all
106+
#/
107+
all: $(c_targets)
108+
109+
.PHONY: all
110+
111+
#/
112+
# Compiles C source files.
113+
#
114+
# @private
115+
# @param {string} CC - C compiler (e.g., `gcc`)
116+
# @param {string} CFLAGS - C compiler options
117+
# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
118+
# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`)
119+
# @param {string} SOURCE_FILES - list of source files
120+
# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`)
121+
# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`)
122+
#/
123+
$(c_targets): %.out: %.c
124+
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
125+
126+
#/
127+
# Runs compiled benchmarks.
128+
#
129+
# @example
130+
# make run
131+
#/
132+
run: $(c_targets)
133+
$(QUIET) ./$<
134+
135+
.PHONY: run
136+
137+
#/
138+
# Removes generated files.
139+
#
140+
# @example
141+
# make clean
142+
#/
143+
clean:
144+
$(QUIET) -rm -f *.o *.out
145+
146+
.PHONY: clean

0 commit comments

Comments
 (0)