diff --git a/math/base/special/lucas/coverage.ndjson b/math/base/special/lucas/coverage.ndjson new file mode 100644 index 000000000..17bdbbc90 --- /dev/null +++ b/math/base/special/lucas/coverage.ndjson @@ -0,0 +1 @@ +[224,224,100,10,10,100,2,2,100,224,224,100,"16c903bdbd31c7d81bc3d6811e942e35c6de38e6","2024-10-01 00:48:05 -0700"] diff --git a/math/base/special/lucas/index.html b/math/base/special/lucas/index.html new file mode 100644 index 000000000..2cdc00373 --- /dev/null +++ b/math/base/special/lucas/index.html @@ -0,0 +1,146 @@ + + + + +
++ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
---|---|---|---|---|---|---|---|---|---|
index.js | +
+
+ |
+ 100% | +58/58 | +100% | +1/1 | +100% | +0/0 | +100% | +58/58 | +
main.js | +
+
+ |
+ 100% | +92/92 | +100% | +7/7 | +100% | +1/1 | +100% | +92/92 | +
native.js | +
+
+ |
+ 100% | +74/74 | +100% | +2/2 | +100% | +1/1 | +100% | +74/74 | +
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 | 1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x + | /** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Compute the nth Lucas number. +* +* @module @stdlib/math/base/special/lucas +* +* @example +* var lucas = require( '@stdlib/math/base/special/lucas' ); +* +* var y = lucas( 0 ); +* // returns 2 +* +* y = lucas( 1 ); +* // returns 1 +* +* y = lucas( 2 ); +* // returns 3 +* +* y = lucas( 3 ); +* // returns 4 +* +* y = lucas( 4 ); +* // returns 7 +* +* y = lucas( 5 ); +* // returns 11 +* +* y = lucas( 6 ); +* // returns 18 +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; + |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 | 1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +603x +603x +603x +603x +603x +501x +603x +526x +526x +77x +603x +1x +1x +1x +1x +1x + | /** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var isInteger = require( '@stdlib/math/base/assert/is-integer' ); +var MAX_LUCAS = require( '@stdlib/constants/float64/max-safe-nth-lucas' ); +var LUCAS = require( './lucas.json' ); + + +// MAIN // + +/** +* Computes the nth Lucas number. +* +* @param {NonNegativeInteger} n - the Lucas number to compute +* @returns {NonNegativeInteger} Lucas number +* +* @example +* var y = lucas( 0 ); +* // returns 2 +* +* @example +* var y = lucas( 1 ); +* // returns 1 +* +* @example +* var y = lucas( 2 ); +* // returns 3 +* +* @example +* var y = lucas( 3 ); +* // returns 4 +* +* @example +* var y = lucas( 4 ); +* // returns 7 +* +* @example +* var y = lucas( 5 ); +* // returns 11 +* +* @example +* var y = lucas( 6 ); +* // returns 18 +* +* @example +* var y = lucas( NaN ); +* // returns NaN +* +* @example +* var y = lucas( 3.14 ); +* // returns NaN +* +* @example +* var y = lucas( -1.0 ); +* // returns NaN +*/ +function lucas( n ) { + if ( + isnan( n ) || + isInteger( n ) === false || + n < 0 || + n > MAX_LUCAS + ) { + return NaN; + } + return LUCAS[ n ]; +} + + +// EXPORTS // + +module.exports = lucas; + |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 | 1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +599x +599x +599x +1x +1x +1x +1x +1x + | /** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Computes the nth Lucas number. +* +* @private +* @param {NonNegativeInteger} n - the Lucas number to compute +* @returns {NonNegativeInteger} Lucas number +* +* @example +* var y = lucas( 0 ); +* // returns 2 +* +* @example +* var y = lucas( 1 ); +* // returns 1 +* +* @example +* var y = lucas( 2 ); +* // returns 3 +* +* @example +* var y = lucas( 3 ); +* // returns 4 +* +* @example +* var y = lucas( 4 ); +* // returns 7 +* +* @example +* var y = lucas( 5 ); +* // returns 11 +* +* @example +* var y = lucas( 6 ); +* // returns 18 +* +* @example +* var y = lucas( -1.0 ); +* // returns NaN +*/ +function lucas( n ) { + return addon( n ); +} + + +// EXPORTS // + +module.exports = lucas; + |