@stdlib/math-base-special-negafibonaccif 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
package/NOTICE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md ADDED
@@ -0,0 +1,334 @@
1
+ <!--
2
+
3
+ @license Apache-2.0
4
+
5
+ Copyright (c) 2025 The Stdlib Authors.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ -->
20
+
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
32
+ # negaFibonaccif
33
+
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
35
+
36
+ > Compute the nth [negaFibonacci number][fibonacci-number] as a [single-precision floating-point number][ieee754].
37
+
38
+ <section class="intro">
39
+
40
+ The [negaFibonacci numbers][fibonacci-number] are the integer sequence
41
+
42
+ <!-- <equation class="equation" label="eq:negafibonacci_sequence" align="center" raw="0, 1, -1, 2, -3, 5, -8, 13, -21, 34, -55, 89, -144, \ldots" alt="NegaFibonacci sequence"> -->
43
+
44
+ <!-- </equation> -->
45
+
46
+ The sequence is defined by the recurrence relation
47
+
48
+ <!-- <equation class="equation" label="eq:negafibonacci_recurrence_relation" align="center" raw="F_{n-2} = F_{n} - F_{n-1}" alt="NegaFibonacci sequence recurrence relation"> -->
49
+
50
+ <!-- </equation> -->
51
+
52
+ which yields
53
+
54
+ <!-- <equation class="equation" label="eq:negafibonacci_fibonacci" align="center" raw="F_{-n} = (-1)^{n+1} F_n" alt="NegaFibonacci relationship to Fibonacci numbers"> -->
55
+
56
+ <!-- </equation> -->
57
+
58
+ with seed values `F_0 = 0` and `F_{-1} = 1`.
59
+
60
+ </section>
61
+
62
+ <!-- /.intro -->
63
+
64
+ <section class="installation">
65
+
66
+ ## Installation
67
+
68
+ ```bash
69
+ npm install @stdlib/math-base-special-negafibonaccif
70
+ ```
71
+
72
+ </section>
73
+
74
+ <section class="usage">
75
+
76
+ ## Usage
77
+
78
+ ```javascript
79
+ var negafibonaccif = require( '@stdlib/math-base-special-negafibonaccif' );
80
+ ```
81
+
82
+ #### negafibonaccif( n )
83
+
84
+ Computes the nth [negaFibonacci number][fibonacci-number] as a [single-precision floating-point number][ieee754].
85
+
86
+ ```javascript
87
+ var v = negafibonaccif( 0 );
88
+ // returns 0
89
+
90
+ v = negafibonaccif( -1 );
91
+ // returns 1
92
+
93
+ v = negafibonaccif( -2 );
94
+ // returns -1
95
+
96
+ v = negafibonaccif( -3 );
97
+ // returns 2
98
+
99
+ v = negafibonaccif( -36 );
100
+ // returns -14930352
101
+ ```
102
+
103
+ If `n < -36`, the function returns `NaN`, as larger [negaFibonacci numbers][fibonacci-number] cannot be safely represented in [single-precision floating-point format][ieee754].
104
+
105
+ ```javascript
106
+ var v = negafibonaccif( -37 );
107
+ // returns NaN
108
+ ```
109
+
110
+ If not provided a nonpositive integer value, the function returns `NaN`.
111
+
112
+ ```javascript
113
+ var v = negafibonaccif( -3.14 );
114
+ // returns NaN
115
+
116
+ v = negafibonaccif( 1 );
117
+ // returns NaN
118
+ ```
119
+
120
+ If provided `NaN`, the function returns `NaN`.
121
+
122
+ ```javascript
123
+ var v = negafibonaccif( NaN );
124
+ // returns NaN
125
+ ```
126
+
127
+ </section>
128
+
129
+ <!-- /.usage -->
130
+
131
+ <section class="notes">
132
+
133
+ </section>
134
+
135
+ <!-- /.notes -->
136
+
137
+ <section class="examples">
138
+
139
+ ## Examples
140
+
141
+ <!-- eslint no-undef: "error" -->
142
+
143
+ ```javascript
144
+ var logEachMap = require( '@stdlib/console-log-each-map' );
145
+ var linspace = require( '@stdlib/array-base-linspace' );
146
+ var negafibonaccif = require( '@stdlib/math-base-special-negafibonaccif' );
147
+
148
+ var v = linspace( -36, 0, 37 );
149
+
150
+ logEachMap( 'negafibonaccif(%d) = %0.4f', v, negafibonaccif );
151
+ ```
152
+
153
+ </section>
154
+
155
+ <!-- /.examples -->
156
+
157
+ <!-- C interface documentation. -->
158
+
159
+ * * *
160
+
161
+ <section class="c">
162
+
163
+ ## C APIs
164
+
165
+ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
166
+
167
+ <section class="intro">
168
+
169
+ </section>
170
+
171
+ <!-- /.intro -->
172
+
173
+ <!-- C usage documentation. -->
174
+
175
+ <section class="usage">
176
+
177
+ ### Usage
178
+
179
+ ```c
180
+ #include "stdlib/math/base/special/negafibonaccif.h"
181
+ ```
182
+
183
+ #### stdlib_base_negafibonaccif( n )
184
+
185
+ Computes the nth [negaFibonacci number][fibonacci-number] as a [single-precision floating-point number][ieee754].
186
+
187
+ ```c
188
+ float out = stdlib_base_negafibonaccif( 0.0f );
189
+ // returns 0.0f
190
+
191
+ out = stdlib_base_negafibonaccif( -1.0f );
192
+ // returns 1.0f
193
+ ```
194
+
195
+ The function accepts the following arguments:
196
+
197
+ - **n**: `[in] float` input value.
198
+
199
+ ```c
200
+ float stdlib_base_negafibonaccif( const float n );
201
+ ```
202
+
203
+ </section>
204
+
205
+ <!-- /.usage -->
206
+
207
+ <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
208
+
209
+ <section class="notes">
210
+
211
+ </section>
212
+
213
+ <!-- /.notes -->
214
+
215
+ <!-- C API usage examples. -->
216
+
217
+ <section class="examples">
218
+
219
+ ### Examples
220
+
221
+ ```c
222
+ #include "stdlib/math/base/special/negafibonaccif.h"
223
+ #include <stdio.h>
224
+
225
+ int main( void ) {
226
+ float i;
227
+ float v;
228
+
229
+ for ( i = 0.0f; i > -37.0f; i-- ) {
230
+ v = stdlib_base_negafibonaccif( i );
231
+ printf( "negafibonaccif(%f) = %f\n", i, v );
232
+ }
233
+ }
234
+ ```
235
+
236
+ </section>
237
+
238
+ <!-- /.examples -->
239
+
240
+ </section>
241
+
242
+ <!-- /.c -->
243
+
244
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
245
+
246
+ <section class="related">
247
+
248
+ </section>
249
+
250
+ <!-- /.related -->
251
+
252
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
253
+
254
+
255
+ <section class="main-repo" >
256
+
257
+ * * *
258
+
259
+ ## Notice
260
+
261
+ This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
262
+
263
+ For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
264
+
265
+ #### Community
266
+
267
+ [![Chat][chat-image]][chat-url]
268
+
269
+ ---
270
+
271
+ ## License
272
+
273
+ See [LICENSE][stdlib-license].
274
+
275
+
276
+ ## Copyright
277
+
278
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
279
+
280
+ </section>
281
+
282
+ <!-- /.stdlib -->
283
+
284
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
285
+
286
+ <section class="links">
287
+
288
+ [npm-image]: http://img.shields.io/npm/v/@stdlib/math-base-special-negafibonaccif.svg
289
+ [npm-url]: https://npmjs.org/package/@stdlib/math-base-special-negafibonaccif
290
+
291
+ [test-image]: https://github.com/stdlib-js/math-base-special-negafibonaccif/actions/workflows/test.yml/badge.svg?branch=v0.1.0
292
+ [test-url]: https://github.com/stdlib-js/math-base-special-negafibonaccif/actions/workflows/test.yml?query=branch:v0.1.0
293
+
294
+ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-special-negafibonaccif/main.svg
295
+ [coverage-url]: https://codecov.io/github/stdlib-js/math-base-special-negafibonaccif?branch=main
296
+
297
+ <!--
298
+
299
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/math-base-special-negafibonaccif.svg
300
+ [dependencies-url]: https://david-dm.org/stdlib-js/math-base-special-negafibonaccif/main
301
+
302
+ -->
303
+
304
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
305
+ [chat-url]: https://stdlib.zulipchat.com
306
+
307
+ [stdlib]: https://github.com/stdlib-js/stdlib
308
+
309
+ [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
310
+
311
+ [umd]: https://github.com/umdjs/umd
312
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
313
+
314
+ [deno-url]: https://github.com/stdlib-js/math-base-special-negafibonaccif/tree/deno
315
+ [deno-readme]: https://github.com/stdlib-js/math-base-special-negafibonaccif/blob/deno/README.md
316
+ [umd-url]: https://github.com/stdlib-js/math-base-special-negafibonaccif/tree/umd
317
+ [umd-readme]: https://github.com/stdlib-js/math-base-special-negafibonaccif/blob/umd/README.md
318
+ [esm-url]: https://github.com/stdlib-js/math-base-special-negafibonaccif/tree/esm
319
+ [esm-readme]: https://github.com/stdlib-js/math-base-special-negafibonaccif/blob/esm/README.md
320
+ [branches-url]: https://github.com/stdlib-js/math-base-special-negafibonaccif/blob/main/branches.md
321
+
322
+ [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/math-base-special-negafibonaccif/main/LICENSE
323
+
324
+ [fibonacci-number]: https://en.wikipedia.org/wiki/Fibonacci_number
325
+
326
+ [ieee754]: https://en.wikipedia.org/wiki/IEEE_754-1985
327
+
328
+ <!-- <related-links> -->
329
+
330
+ <!-- </related-links> -->
331
+
332
+ </section>
333
+
334
+ <!-- /.links -->
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import negafibonaccif from '../docs/types/index';
3
+ export = negafibonaccif;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var a=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=a(function(A,s){s.exports=[0,1,-1,2,-3,5,-8,13,-21,34,-55,89,-144,233,-377,610,-987,1597,-2584,4181,-6765,10946,-17711,28657,-46368,75025,-121393,196418,-317811,514229,-832040,1346269,-2178309,3524578,-5702887,9227465,-14930352]});var t=a(function(C,u){
2
+ var f=require('@stdlib/math-base-assert-is-nanf/dist'),n=require('@stdlib/math-base-assert-is-integerf/dist'),v=require('@stdlib/math-base-special-absf/dist'),N=require('@stdlib/constants-float32-max-safe-nth-fibonacci/dist'),q=i();function c(e){var r;return f(e)||n(e)===!1||e>0?NaN:(r=v(e),r>N?NaN:q[r])}u.exports=c
3
+ });var I=t();module.exports=I;
4
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/negafibonaccif.json", "../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["[0,1,-1,2,-3,5,-8,13,-21,34,-55,89,-144,233,-377,610,-987,1597,-2584,4181,-6765,10946,-17711,28657,-46368,75025,-121393,196418,-317811,514229,-832040,1346269,-2178309,3524578,-5702887,9227465,-14930352]\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isnanf = require( '@stdlib/math-base-assert-is-nanf' );\nvar isIntegerf = require( '@stdlib/math-base-assert-is-integerf' );\nvar absf = require( '@stdlib/math-base-special-absf' );\nvar MAX_FIBONACCI = require( '@stdlib/constants-float32-max-safe-nth-fibonacci' );\nvar NEGAFIBONACCIF = require( './negafibonaccif.json' );\n\n\n// MAIN //\n\n/**\n* Computes the nth negaFibonacci number as a single-precision floating-point number.\n*\n* @param {NonPositiveInteger} n - the negaFibonacci number to compute\n* @returns {integer} negaFibonacci number\n*\n* @example\n* var y = negafibonaccif( 0 );\n* // returns 0\n*\n* @example\n* var y = negafibonaccif( -1 );\n* // returns 1\n*\n* @example\n* var y = negafibonaccif( -2 );\n* // returns -1\n*\n* @example\n* var y = negafibonaccif( -3 );\n* // returns 2\n*\n* @example\n* var y = negafibonaccif( -4 );\n* // returns -3\n*\n* @example\n* var y = negafibonaccif( -5 );\n* // returns 5\n*\n* @example\n* var y = negafibonaccif( -6 );\n* // returns -8\n*\n* @example\n* var y = negafibonaccif( NaN );\n* // returns NaN\n*\n* @example\n* var y = negafibonaccif( -3.14 );\n* // returns NaN\n*/\nfunction negafibonaccif( n ) {\n\tvar an;\n\tif (\n\t\tisnanf( n ) ||\n\t\tisIntegerf( n ) === false ||\n\t\tn > 0\n\t) {\n\t\treturn NaN;\n\t}\n\tan = absf( n );\n\tif ( an > MAX_FIBONACCI ) {\n\t\treturn NaN;\n\t}\n\treturn NEGAFIBONACCIF[ an ];\n}\n\n\n// EXPORTS //\n\nmodule.exports = negafibonaccif;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Compute the nth negaFibonacci number as a single-precision floating-point number.\n*\n* @module @stdlib/math-base-special-negafibonaccif\n*\n* @example\n* var negafibonaccif = require( '@stdlib/math-base-special-negafibonaccif' );\n*\n* var y = negafibonaccif( 0 );\n* // returns 0\n*\n* y = negafibonaccif( -1 );\n* // returns 1\n*\n* y = negafibonaccif( -2 );\n* // returns -1\n*\n* y = negafibonaccif( -3 );\n* // returns 2\n*\n* y = negafibonaccif( -4 );\n* // returns -3\n*\n* y = negafibonaccif( -5 );\n* // returns 5\n*\n* y = negafibonaccif( -6 );\n* // returns -8\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,CAAAA,EAAA,SAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,IAAI,KAAK,IAAI,KAAK,KAAK,MAAM,KAAK,MAAM,MAAM,OAAO,MAAM,OAAO,MAAM,QAAQ,OAAO,QAAQ,OAAO,QAAQ,QAAQ,SAAS,QAAQ,SAAS,QAAQ,SAAS,ICAzM,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,QAAS,kCAAmC,EACrDC,EAAa,QAAS,sCAAuC,EAC7DC,EAAO,QAAS,gCAAiC,EACjDC,EAAgB,QAAS,kDAAmD,EAC5EC,EAAiB,IA+CrB,SAASC,EAAgBC,EAAI,CAC5B,IAAIC,EACJ,OACCP,EAAQM,CAAE,GACVL,EAAYK,CAAE,IAAM,IACpBA,EAAI,EAEG,KAERC,EAAKL,EAAMI,CAAE,EACRC,EAAKJ,EACF,IAEDC,EAAgBG,CAAG,EAC3B,CAKAR,EAAO,QAAUM,ICxCjB,IAAIG,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_negafibonaccif", "__commonJSMin", "exports", "module", "require_main", "__commonJSMin", "exports", "module", "isnanf", "isIntegerf", "absf", "MAX_FIBONACCI", "NEGAFIBONACCIF", "negafibonaccif", "n", "an", "main"]
7
+ }
@@ -0,0 +1,74 @@
1
+ /*
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ // TypeScript Version: 4.1
20
+
21
+ /**
22
+ * Computes the nth negaFibonacci number as a single-precision floating-point number.
23
+ *
24
+ * ## Notes
25
+ *
26
+ * - The negaFibonacci numbers follow the recurrence relation `F_{n-2} = F_{n} - F_{n-1}` with seed values `F_0 = 0` and `F_{-1} = 1`.
27
+ * - If `|n|` is greater than `36`, the function returns `NaN` as larger negaFibonacci numbers cannot be accurately represented due to limitations of single-precision floating-point format.
28
+ * - If not provided a non-positive integer value, the function returns `NaN`.
29
+ *
30
+ * @param n - the negaFibonacci number to compute
31
+ * @returns negaFibonacci number
32
+ *
33
+ * @example
34
+ * var y = negafibonaccif( 0 );
35
+ * // returns 0
36
+ *
37
+ * @example
38
+ * var y = negafibonaccif( -1 );
39
+ * // returns 1
40
+ *
41
+ * @example
42
+ * var y = negafibonaccif( -2 );
43
+ * // returns -1
44
+ *
45
+ * @example
46
+ * var y = negafibonaccif( -3 );
47
+ * // returns 2
48
+ *
49
+ * @example
50
+ * var y = negafibonaccif( -4 );
51
+ * // returns -3
52
+ *
53
+ * @example
54
+ * var y = negafibonaccif( -5 );
55
+ * // returns 5
56
+ *
57
+ * @example
58
+ * var y = negafibonaccif( -6 );
59
+ * // returns -8
60
+ *
61
+ * @example
62
+ * var y = negafibonaccif( NaN );
63
+ * // returns NaN
64
+ *
65
+ * @example
66
+ * var y = negafibonaccif( -3.14 );
67
+ * // returns NaN
68
+ */
69
+ declare function negafibonaccif( n: number ): number;
70
+
71
+
72
+ // EXPORTS //
73
+
74
+ export = negafibonaccif;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ #ifndef STDLIB_MATH_BASE_SPECIAL_NEGAFIBONACCIF_H
20
+ #define STDLIB_MATH_BASE_SPECIAL_NEGAFIBONACCIF_H
21
+
22
+ /*
23
+ * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
24
+ */
25
+ #ifdef __cplusplus
26
+ extern "C" {
27
+ #endif
28
+
29
+ /**
30
+ * Computes the nth negaFibonacci number as a single-precision floating-point number.
31
+ */
32
+ float stdlib_base_negafibonaccif( const float n );
33
+
34
+ #ifdef __cplusplus
35
+ }
36
+ #endif
37
+
38
+ #endif // !STDLIB_MATH_BASE_SPECIAL_NEGAFIBONACCIF_H
package/lib/index.js ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ /**
22
+ * Compute the nth negaFibonacci number as a single-precision floating-point number.
23
+ *
24
+ * @module @stdlib/math-base-special-negafibonaccif
25
+ *
26
+ * @example
27
+ * var negafibonaccif = require( '@stdlib/math-base-special-negafibonaccif' );
28
+ *
29
+ * var y = negafibonaccif( 0 );
30
+ * // returns 0
31
+ *
32
+ * y = negafibonaccif( -1 );
33
+ * // returns 1
34
+ *
35
+ * y = negafibonaccif( -2 );
36
+ * // returns -1
37
+ *
38
+ * y = negafibonaccif( -3 );
39
+ * // returns 2
40
+ *
41
+ * y = negafibonaccif( -4 );
42
+ * // returns -3
43
+ *
44
+ * y = negafibonaccif( -5 );
45
+ * // returns 5
46
+ *
47
+ * y = negafibonaccif( -6 );
48
+ * // returns -8
49
+ */
50
+
51
+ // MODULES //
52
+
53
+ var main = require( './main.js' );
54
+
55
+
56
+ // EXPORTS //
57
+
58
+ module.exports = main;
package/lib/main.js ADDED
@@ -0,0 +1,93 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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 isnanf = require( '@stdlib/math-base-assert-is-nanf' );
24
+ var isIntegerf = require( '@stdlib/math-base-assert-is-integerf' );
25
+ var absf = require( '@stdlib/math-base-special-absf' );
26
+ var MAX_FIBONACCI = require( '@stdlib/constants-float32-max-safe-nth-fibonacci' );
27
+ var NEGAFIBONACCIF = require( './negafibonaccif.json' );
28
+
29
+
30
+ // MAIN //
31
+
32
+ /**
33
+ * Computes the nth negaFibonacci number as a single-precision floating-point number.
34
+ *
35
+ * @param {NonPositiveInteger} n - the negaFibonacci number to compute
36
+ * @returns {integer} negaFibonacci number
37
+ *
38
+ * @example
39
+ * var y = negafibonaccif( 0 );
40
+ * // returns 0
41
+ *
42
+ * @example
43
+ * var y = negafibonaccif( -1 );
44
+ * // returns 1
45
+ *
46
+ * @example
47
+ * var y = negafibonaccif( -2 );
48
+ * // returns -1
49
+ *
50
+ * @example
51
+ * var y = negafibonaccif( -3 );
52
+ * // returns 2
53
+ *
54
+ * @example
55
+ * var y = negafibonaccif( -4 );
56
+ * // returns -3
57
+ *
58
+ * @example
59
+ * var y = negafibonaccif( -5 );
60
+ * // returns 5
61
+ *
62
+ * @example
63
+ * var y = negafibonaccif( -6 );
64
+ * // returns -8
65
+ *
66
+ * @example
67
+ * var y = negafibonaccif( NaN );
68
+ * // returns NaN
69
+ *
70
+ * @example
71
+ * var y = negafibonaccif( -3.14 );
72
+ * // returns NaN
73
+ */
74
+ function negafibonaccif( n ) {
75
+ var an;
76
+ if (
77
+ isnanf( n ) ||
78
+ isIntegerf( n ) === false ||
79
+ n > 0
80
+ ) {
81
+ return NaN;
82
+ }
83
+ an = absf( n );
84
+ if ( an > MAX_FIBONACCI ) {
85
+ return NaN;
86
+ }
87
+ return NEGAFIBONACCIF[ an ];
88
+ }
89
+
90
+
91
+ // EXPORTS //
92
+
93
+ module.exports = negafibonaccif;
package/lib/native.js ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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 addon = require( './../src/addon.node' );
24
+
25
+
26
+ // MAIN //
27
+
28
+ /**
29
+ * Computes the nth negaFibonacci number as a single-precision floating-point number.
30
+ *
31
+ * @private
32
+ * @param {NonPositiveInteger} n - the negaFibonacci number to compute
33
+ * @returns {integer} negaFibonacci number
34
+ *
35
+ * @example
36
+ * var y = negafibonaccif( 0 );
37
+ * // returns 0
38
+ *
39
+ * @example
40
+ * var y = negafibonaccif( -1 );
41
+ * // returns 1
42
+ *
43
+ * @example
44
+ * var y = negafibonaccif( -2 );
45
+ * // returns -1
46
+ *
47
+ * @example
48
+ * var y = negafibonaccif( -3 );
49
+ * // returns 2
50
+ *
51
+ * @example
52
+ * var y = negafibonaccif( -4 );
53
+ * // returns -3
54
+ *
55
+ * @example
56
+ * var y = negafibonaccif( -5 );
57
+ * // returns 5
58
+ *
59
+ * @example
60
+ * var y = negafibonaccif( -6 );
61
+ * // returns -8
62
+ */
63
+ function negafibonaccif( n ) {
64
+ return addon( n );
65
+ }
66
+
67
+
68
+ // EXPORTS //
69
+
70
+ module.exports = negafibonaccif;
@@ -0,0 +1 @@
1
+ [0,1,-1,2,-3,5,-8,13,-21,34,-55,89,-144,233,-377,610,-987,1597,-2584,4181,-6765,10946,-17711,28657,-46368,75025,-121393,196418,-317811,514229,-832040,1346269,-2178309,3524578,-5702887,9227465,-14930352]
package/manifest.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "options": {
3
+ "task": "build"
4
+ },
5
+ "fields": [
6
+ {
7
+ "field": "src",
8
+ "resolve": true,
9
+ "relative": true
10
+ },
11
+ {
12
+ "field": "include",
13
+ "resolve": true,
14
+ "relative": true
15
+ },
16
+ {
17
+ "field": "libraries",
18
+ "resolve": false,
19
+ "relative": false
20
+ },
21
+ {
22
+ "field": "libpath",
23
+ "resolve": true,
24
+ "relative": false
25
+ }
26
+ ],
27
+ "confs": [
28
+ {
29
+ "task": "build",
30
+ "src": [
31
+ "./src/main.c"
32
+ ],
33
+ "include": [
34
+ "./include"
35
+ ],
36
+ "libraries": [],
37
+ "libpath": [],
38
+ "dependencies": [
39
+ "@stdlib/math-base-napi-unary",
40
+ "@stdlib/constants-float32-max-safe-nth-fibonacci",
41
+ "@stdlib/math-base-special-absf",
42
+ "@stdlib/math-base-assert-is-integerf"
43
+ ]
44
+ },
45
+ {
46
+ "task": "benchmark",
47
+ "src": [
48
+ "./src/main.c"
49
+ ],
50
+ "include": [
51
+ "./include"
52
+ ],
53
+ "libraries": [],
54
+ "libpath": [],
55
+ "dependencies": [
56
+ "@stdlib/constants-float32-max-safe-nth-fibonacci",
57
+ "@stdlib/math-base-special-absf",
58
+ "@stdlib/math-base-assert-is-integerf"
59
+ ]
60
+ },
61
+ {
62
+ "task": "examples",
63
+ "src": [
64
+ "./src/main.c"
65
+ ],
66
+ "include": [
67
+ "./include"
68
+ ],
69
+ "libraries": [],
70
+ "libpath": [],
71
+ "dependencies": [
72
+ "@stdlib/constants-float32-max-safe-nth-fibonacci",
73
+ "@stdlib/math-base-special-absf",
74
+ "@stdlib/math-base-assert-is-integerf"
75
+ ]
76
+ }
77
+ ]
78
+ }
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@stdlib/math-base-special-negafibonaccif",
3
+ "version": "0.1.0",
4
+ "description": "Compute the nth negaFibonacci number as a single-precision floating-point number.",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "The Stdlib Authors",
8
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9
+ },
10
+ "contributors": [
11
+ {
12
+ "name": "The Stdlib Authors",
13
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14
+ }
15
+ ],
16
+ "main": "./lib",
17
+ "gypfile": false,
18
+ "directories": {
19
+ "doc": "./docs",
20
+ "include": "./include",
21
+ "lib": "./lib",
22
+ "src": "./src",
23
+ "dist": "./dist"
24
+ },
25
+ "types": "./docs/types",
26
+ "scripts": {},
27
+ "homepage": "https://stdlib.io",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git://github.com/stdlib-js/math-base-special-negafibonaccif.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/stdlib-js/stdlib/issues"
34
+ },
35
+ "dependencies": {
36
+ "@stdlib/constants-float32-max-safe-nth-fibonacci": "^0.1.0",
37
+ "@stdlib/math-base-assert-is-integerf": "github:stdlib-js/math-base-assert-is-integerf#main",
38
+ "@stdlib/math-base-assert-is-nanf": "^0.2.2",
39
+ "@stdlib/math-base-napi-unary": "^0.2.5",
40
+ "@stdlib/math-base-special-absf": "^0.2.2",
41
+ "@stdlib/utils-library-manifest": "^0.2.3"
42
+ },
43
+ "devDependencies": {},
44
+ "engines": {
45
+ "node": ">=0.10.0",
46
+ "npm": ">2.7.0"
47
+ },
48
+ "os": [
49
+ "aix",
50
+ "darwin",
51
+ "freebsd",
52
+ "linux",
53
+ "macos",
54
+ "openbsd",
55
+ "sunos",
56
+ "win32",
57
+ "windows"
58
+ ],
59
+ "keywords": [
60
+ "stdlib",
61
+ "stdmath",
62
+ "mathematics",
63
+ "math",
64
+ "special",
65
+ "function",
66
+ "fibonacci",
67
+ "negafibonacci",
68
+ "fib",
69
+ "nfib",
70
+ "number"
71
+ ],
72
+ "funding": {
73
+ "type": "opencollective",
74
+ "url": "https://opencollective.com/stdlib"
75
+ }
76
+ }
package/src/addon.c ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ #include "stdlib/math/base/special/negafibonaccif.h"
20
+ #include "stdlib/math/base/napi/unary.h"
21
+
22
+ STDLIB_MATH_BASE_NAPI_MODULE_F_F( stdlib_base_negafibonaccif )
package/src/main.c ADDED
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ #include "stdlib/math/base/special/negafibonaccif.h"
20
+ #include "stdlib/math/base/assert/is_integerf.h"
21
+ #include "stdlib/math/base/special/absf.h"
22
+ #include "stdlib/constants/float32/max_safe_nth_fibonacci.h"
23
+ #include <stdlib.h>
24
+
25
+ static const float negafibonaccif_value[ 37 ] = {
26
+ 0.0f,
27
+ 1.0f,
28
+ -1.0f,
29
+ 2.0f,
30
+ -3.0f,
31
+ 5.0f,
32
+ -8.0f,
33
+ 13.0f,
34
+ -21.0f,
35
+ 34.0f,
36
+ -55.0f,
37
+ 89.0f,
38
+ -144.0f,
39
+ 233.0f,
40
+ -377.0f,
41
+ 610.0f,
42
+ -987.0f,
43
+ 1597.0f,
44
+ -2584.0f,
45
+ 4181.0f,
46
+ -6765.0f,
47
+ 10946.0f,
48
+ -17711.0f,
49
+ 28657.0f,
50
+ -46368.0f,
51
+ 75025.0f,
52
+ -121393.0f,
53
+ 196418.0f,
54
+ -317811.0f,
55
+ 514229.0f,
56
+ -832040.0f,
57
+ 1346269.0f,
58
+ -2178309.0f,
59
+ 3524578.0f,
60
+ -5702887.0f,
61
+ 9227465.0f,
62
+ -14930352.0f
63
+ };
64
+
65
+ /**
66
+ * Computes the nth negaFibonacci number as a single-precision floating-point number.
67
+ *
68
+ * @param n input value
69
+ * @return output value
70
+ *
71
+ * @example
72
+ * float out = stdlib_base_negafibonaccif( -1.0f );
73
+ * // returns 1.0f
74
+ */
75
+ float stdlib_base_negafibonaccif( const float n ) {
76
+ float an;
77
+ if ( !stdlib_base_is_integerf( n ) || n > 0.0f ) {
78
+ return 0.0f / 0.0f; // NaN
79
+ }
80
+ an = stdlib_base_absf( n );
81
+ if ( an > STDLIB_CONSTANT_FLOAT32_MAX_SAFE_NTH_FIBONACCI ) {
82
+ return 0.0f / 0.0f; // NaN
83
+ }
84
+ return negafibonaccif_value[ (size_t)an ];
85
+ }