Skip to content

Commit 46c483d

Browse files
committed
docs: fix missing documentation and fix example return value
1 parent 1dd8c2c commit 46c483d

File tree

2 files changed

+89
-1
lines changed

2 files changed

+89
-1
lines changed

lib/node_modules/@stdlib/math/base/special/tribonacci/README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,94 @@ for ( i = 0; i < 64; i++ ) {
137137

138138
<!-- /.examples -->
139139

140+
<!-- C interface documentation. -->
141+
142+
* * *
143+
144+
<section class="c">
145+
146+
## C APIs
147+
148+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
149+
150+
<section class="intro">
151+
152+
</section>
153+
154+
<!-- /.intro -->
155+
156+
<!-- C usage documentation. -->
157+
158+
<section class="usage">
159+
160+
### Usage
161+
162+
```c
163+
#include "stdlib/math/base/special/tribonacci.h"
164+
```
165+
166+
#### stdlib_base_tribonacci( n )
167+
168+
Computes the nth [Tribonacci number][tribonacci-number].
169+
170+
```c
171+
double out = stdlib_base_tribonacci( 0 );
172+
// returns 0
173+
174+
out = stdlib_base_tribonacci( 1 );
175+
// returns 0
176+
```
177+
178+
The function accepts the following arguments:
179+
180+
- **n**: `[in] int32_t` input value.
181+
182+
```c
183+
double stdlib_base_tribonacci( const int32_t n );
184+
```
185+
186+
</section>
187+
188+
<!-- /.usage -->
189+
190+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
191+
192+
<section class="notes">
193+
194+
</section>
195+
196+
<!-- /.notes -->
197+
198+
<!-- C API usage examples. -->
199+
200+
<section class="examples">
201+
202+
### Examples
203+
204+
```c
205+
#include "stdlib/math/base/special/tribonacci.h"
206+
#include <stdio.h>
207+
#include <stdint.h>
208+
209+
int main() {
210+
int32_t i;
211+
double v;
212+
213+
for ( i = 0; i < 64; i++ ) {
214+
v = stdlib_base_tribonacci( i );
215+
printf( "tribonacci(%d) = %lf\n", i, v );
216+
}
217+
}
218+
```
219+
220+
</section>
221+
222+
<!-- /.examples -->
223+
224+
</section>
225+
226+
<!-- /.c -->
227+
140228
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
141229

142230
<section class="related">

lib/node_modules/@stdlib/math/base/special/tribonacci/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static const int64_t tribonacci_value[ 64 ] = {
9393
*
9494
* @example
9595
* double out = stdlib_base_tribonacci( 1 );
96-
* // returns 1
96+
* // returns 0
9797
*/
9898
double stdlib_base_tribonacci( const int32_t n ) {
9999
if ( n < 0 || n > STDLIB_CONSTANTS_FLOAT64_MAX_SAFE_NTH_TRIBONACCI ) {

0 commit comments

Comments
 (0)