Skip to content

Commit db730d6

Browse files
committed
Updated README to include the C API documentation
1 parent 76fe5d2 commit db730d6

File tree

1 file changed

+98
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev

1 file changed

+98
-0
lines changed

lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,104 @@ for ( i = 0; i < 10; i++ ) {
131131

132132
<!-- /.examples -->
133133

134+
<!-- C interface documentation. -->
135+
136+
* * *
137+
138+
<section class="c">
139+
140+
## C APIs
141+
142+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
143+
144+
<section class="intro">
145+
146+
</section>
147+
148+
<!-- /.intro -->
149+
150+
<!-- C usage documentation. -->
151+
152+
<section class="usage">
153+
154+
### Usage
155+
156+
```c
157+
#include "stdlib/stats/base/dists/arcsine/stdev.h"
158+
```
159+
160+
#### stdlib_base_dists_arcsine_stdev( a, b )
161+
162+
Returns the standard deviation of an arcsine distribution.
163+
164+
```c
165+
double out = stdlib_base_dists_arcsine_stdev( 4.0, 12.0 );
166+
// returns ~2.828
167+
```
168+
169+
The function accepts the following arguments:
170+
171+
- **a**: `[in] double` minimum support.
172+
- **b**: `[in] double` maximum support.
173+
174+
```c
175+
double stdlib_base_dists_arcsine_stdev( const double a, const double b );
176+
```
177+
178+
</section>
179+
180+
<!-- /.usage -->
181+
182+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
183+
184+
<section class="notes">
185+
186+
</section>
187+
188+
<!-- /.notes -->
189+
190+
<!-- C API usage examples. -->
191+
192+
<section class="examples">
193+
194+
### Examples
195+
196+
```c
197+
#include "stdlib/stats/base/dists/arcsine/stdev.h"
198+
#include <stdlib.h>
199+
#include <stdio.h>
200+
201+
static double random_uniform( const double min, const double max ) {
202+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
203+
return min + ( v * ( max - min ) );
204+
}
205+
206+
int main( void ) {
207+
double a;
208+
double b;
209+
double s;
210+
int i;
211+
212+
for ( i = 0; i < 10; i++ ) {
213+
a = random_uniform( -20.0, 0.0 );
214+
b = random_uniform( a, a + 40.0 );
215+
s = stdlib_base_dists_arcsine_stdev( a, b );
216+
217+
printf( "a: %lf, b: %lf, Standard Deviation: %lf\n", a, b, s );
218+
}
219+
220+
return 0;
221+
}
222+
```
223+
224+
</section>
225+
226+
<!-- /.examples -->
227+
228+
</section>
229+
230+
<!-- /.c -->
231+
134232
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
135233

136234
<section class="references">

0 commit comments

Comments
 (0)