@stdlib/math-base-special-absf
Advanced tools
Sorry, the diff of this file is not supported yet
| /// <reference path="../docs/types/index.d.ts" /> | ||
| import absf from '../docs/types/index'; | ||
| export = absf; |
| "use strict";var a=function(t,r){return function(){return r||t((r={exports:{}}).exports,r),r.exports}};var e=a(function(c,s){ | ||
| function i(t){return Math.abs(t)}s.exports=i | ||
| });var u=e();module.exports=u; | ||
| /** @license Apache-2.0 */ | ||
| /** @license Apache-2.0 */ | ||
| //# sourceMappingURL=index.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../lib/main.js", "../lib/index.js"], | ||
| "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a single-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = absf( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = absf( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = absf( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = absf( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = absf( NaN );\n* // returns NaN\n*/\nfunction absf( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nmodule.exports = absf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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 an absolute value of a single-precision floating-point number.\n*\n* @module @stdlib/math-base-special-absf\n*\n* @example\n* var absf = require( '@stdlib/math-base-special-absf' );\n*\n* var v = absf( -1.0 );\n* // returns 1.0\n*\n* v = absf( 2.0 );\n* // returns 2.0\n*\n* v = absf( 0.0 );\n* // returns 0.0\n*\n* v = absf( -0.0 );\n* // returns 0.0\n*\n* v = absf( NaN );\n* // returns NaN\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], | ||
| "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgDA,SAASC,EAAMC,EAAI,CAClB,OAAO,KAAK,IAAKA,CAAE,CACpB,CAKAF,EAAO,QAAUC,ICTjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", | ||
| "names": ["require_main", "__commonJSMin", "exports", "module", "absf", "x", "main"] | ||
| } |
+38
| /** | ||
| * @license Apache-2.0 | ||
| * | ||
| * Copyright (c) 2020 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. | ||
| */ | ||
| #include "stdlib/math/base/special/absf.h" | ||
| #include "stdlib/constants/float32/abs_mask.h" | ||
| #include "stdlib/number/float32/base/to_word.h" | ||
| /** | ||
| * Computes the absolute value of a single-precision floating-point number. | ||
| * | ||
| * @param x number | ||
| * @return absolute value | ||
| * | ||
| * @example | ||
| * float y = stdlib_base_absf( -5.0f ); | ||
| * // returns 5.0f | ||
| */ | ||
| float stdlib_base_absf( const float x ) { | ||
| stdlib_base_float32_word_t w; | ||
| w.value = x; | ||
| w.word &= STDLIB_CONSTANT_FLOAT32_ABS_MASK; | ||
| return w.value; | ||
| } |
@@ -19,3 +19,3 @@ /* | ||
| // TypeScript Version: 2.0 | ||
| // TypeScript Version: 4.1 | ||
@@ -22,0 +22,0 @@ /** |
+1
-3
@@ -25,2 +25,3 @@ /** | ||
| var Uint32Array = require( '@stdlib/array-uint32' ); | ||
| var ABS_MASK = require( '@stdlib/constants-float32-abs-mask' ); | ||
@@ -33,6 +34,3 @@ | ||
| // 0x7fffffff = 2147483647 => 0 11111111111 11111111111111111111 | ||
| var ABS_MASK = 0x7fffffff>>>0; // asm type annotation | ||
| // MAIN // | ||
@@ -39,0 +37,0 @@ |
+2
-2
@@ -47,3 +47,3 @@ /** | ||
| var absf = require( './main.js' ); | ||
| var main = require( './main.js' ); | ||
@@ -53,2 +53,2 @@ | ||
| module.exports = absf; | ||
| module.exports = main; |
+0
-304
@@ -178,305 +178,1 @@ | ||
| END OF TERMS AND CONDITIONS | ||
| Boost Software License - Version 1.0 - August 17th, 2003 | ||
| Permission is hereby granted, free of charge, to any person or organization | ||
| obtaining a copy of the software and accompanying documentation covered by this | ||
| license (the "Software") to use, reproduce, display, distribute, execute, and | ||
| transmit the Software, and to prepare derivative works of the Software, and to | ||
| permit third-parties to whom the Software is furnished to do so, all subject to | ||
| the following: | ||
| The copyright notices in the Software and this entire statement, including the | ||
| above license grant, this restriction and the following disclaimer, must be | ||
| included in all copies of the Software, in whole or in part, and all derivative | ||
| works of the Software, unless such copies or derivative works are solely in the | ||
| form of machine-executable object code generated by a source language processor. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
| COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES | ||
| OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF | ||
| OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| DEPENDENCIES | ||
| The library links against the following external libraries, which have their own | ||
| licenses: | ||
| * OpenBLAS <https://raw.githubusercontent.com/xianyi/OpenBLAS/ | ||
| def146efed8d5908ea04e22668feeab7099599a0/LICENSE> | ||
| Copyright (c) 2011-2014, The OpenBLAS Project | ||
| All rights reserved. | ||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are | ||
| met: | ||
| 1. Redistributions of source code must retain the above copyright | ||
| notice, this list of conditions and the following disclaimer. | ||
| 2. Redistributions in binary form must reproduce the above copyright | ||
| notice, this list of conditions and the following disclaimer in | ||
| the documentation and/or other materials provided with the | ||
| distribution. | ||
| 3. Neither the name of the OpenBLAS project nor the names of | ||
| its contributors may be used to endorse or promote products | ||
| derived from this software without specific prior written | ||
| permission. | ||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
| GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | ||
| THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * Electron <https://raw.githubusercontent.com/electron/electron/ | ||
| c4cfb3e7110266b9d7ad80e1ae097c4db564501c/LICENSE> | ||
| Copyright (c) 2013-2017 GitHub Inc. | ||
| Permission is hereby granted, free of charge, to any person obtaining | ||
| a copy of this software and associated documentation files (the | ||
| "Software"), to deal in the Software without restriction, including | ||
| without limitation the rights to use, copy, modify, merge, publish, | ||
| distribute, sublicense, and/or sell copies of the Software, and to | ||
| permit persons to whom the Software is furnished to do so, subject to | ||
| the following conditions: | ||
| The above copyright notice and this permission notice shall be | ||
| included in all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
| LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
| WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| * Boost <http://www.boost.org/LICENSE_1_0.txt> | ||
| Boost Software License - Version 1.0 - August 17th, 2003 | ||
| Permission is hereby granted, free of charge, to any person or organization | ||
| obtaining a copy of the software and accompanying documentation covered by | ||
| this license (the "Software") to use, reproduce, display, distribute, | ||
| execute, and transmit the Software, and to prepare derivative works of the | ||
| Software, and to permit third-parties to whom the Software is furnished to | ||
| do so, all subject to the following: | ||
| The copyright notices in the Software and this entire statement, including | ||
| the above license grant, this restriction and the following disclaimer, | ||
| must be included in all copies of the Software, in whole or in part, and | ||
| all derivative works of the Software, unless such copies or derivative | ||
| works are solely in the form of machine-executable object code generated by | ||
| a source language processor. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT | ||
| SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE | ||
| FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, | ||
| ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| DEALINGS IN THE SOFTWARE. | ||
| * Cephes <http://www.netlib.org/cephes/readme> | ||
| Copyright (c) 1984-2000 Stephen L. Moshier | ||
| Some software in this archive may be from the book _Methods and Programs for | ||
| Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) | ||
| or from the Cephes Mathematical Library, a commercial product. In either event, | ||
| it is copyrighted by the author. What you see here may be used freely but it | ||
| comes with no support or guarantee. | ||
| Stephen L. Moshier | ||
| moshier@na-net.ornl.gov | ||
| ATTRIBUTION | ||
| The library contains implementations from the following external libraries, | ||
| which have their own licenses: | ||
| * FreeBSD <https://svnweb.freebsd.org/> | ||
| Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. | ||
| Developed at SunPro, a Sun Microsystems, Inc. business. | ||
| Permission to use, copy, modify, and distribute this | ||
| software is freely granted, provided that this notice | ||
| is preserved. | ||
| * FDLIBM <http://www.netlib.org/fdlibm/> | ||
| Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. | ||
| Developed at SunPro, a Sun Microsystems, Inc. business. | ||
| Permission to use, copy, modify, and distribute this | ||
| software is freely granted, provided that this notice | ||
| is preserved. | ||
| * Go <https://raw.githubusercontent.com/golang/go/master/LICENSE> | ||
| Copyright (c) 2009 The Go Authors. All rights reserved. | ||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are | ||
| met: | ||
| * Redistributions of source code must retain the above copyright | ||
| notice, this list of conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above | ||
| copyright notice, this list of conditions and the following disclaimer | ||
| in the documentation and/or other materials provided with the | ||
| distribution. | ||
| * Neither the name of Google Inc. nor the names of its | ||
| contributors may be used to endorse or promote products derived from | ||
| this software without specific prior written permission. | ||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * SLATEC Common Mathematical Library <http://www.netlib.no/netlib/slatec/> | ||
| Public domain. | ||
| * ESLint <https://raw.githubusercontent.com/eslint/eslint/master/LICENSE> | ||
| Copyright JS Foundation and other contributors, https://js.foundation | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. | ||
| * StatsFuns.jl <https://raw.githubusercontent.com/JuliaStats/StatsFuns.jl/ | ||
| e66dd973650c375bc1739c820e5b96bb5bd000a8/LICENSE.md> | ||
| Copyright (c) 2015: Dahua Lin. | ||
| Permission is hereby granted, free of charge, to any person obtaining | ||
| a copy of this software and associated documentation files (the | ||
| "Software"), to deal in the Software without restriction, including | ||
| without limitation the rights to use, copy, modify, merge, publish, | ||
| distribute, sublicense, and/or sell copies of the Software, and to | ||
| permit persons to whom the Software is furnished to do so, subject to | ||
| the following conditions: | ||
| The above copyright notice and this permission notice shall be | ||
| included in all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| * SpecialFunctions.jl <https://raw.githubusercontent.com/JuliaMath/ | ||
| SpecialFunctions.jl/02a173fbe24a61c4b392aec17a9764ac5727feb1/LICENSE> | ||
| The MIT License (MIT) | ||
| Copyright (c) 2017 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and others: | ||
| https://github.com/JuliaMath/SpecialFunctions.jl/graphs/contributors | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. | ||
| * MT19937 <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/ | ||
| mt19937ar.c> | ||
| Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, | ||
| All rights reserved. | ||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions | ||
| are met: | ||
| 1. Redistributions of source code must retain the above copyright | ||
| notice, this list of conditions and the following disclaimer. | ||
| 2. Redistributions in binary form must reproduce the above copyright | ||
| notice, this list of conditions and the following disclaimer in the | ||
| documentation and/or other materials provided with the distribution. | ||
| 3. The names of its contributors may not be used to endorse or promote | ||
| products derived from this software without specific prior written | ||
| permission. | ||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+9
-9
@@ -31,3 +31,3 @@ { | ||
| "src": [ | ||
| "./src/absf.c" | ||
| "./src/main.c" | ||
| ], | ||
@@ -41,4 +41,4 @@ "include": [ | ||
| "@stdlib/math-base-napi-unary", | ||
| "@stdlib/number-float32-base-to-word" | ||
| "@stdlib/constants-float32-abs-mask", | ||
| "@stdlib/number-float32-base-to-word" | ||
| ] | ||
@@ -49,3 +49,3 @@ }, | ||
| "src": [ | ||
| "./src/absf.c" | ||
| "./src/main.c" | ||
| ], | ||
@@ -58,4 +58,4 @@ "include": [ | ||
| "dependencies": [ | ||
| "@stdlib/number-float32-base-to-word" | ||
| "@stdlib/constants-float32-abs-mask", | ||
| "@stdlib/number-float32-base-to-word" | ||
| ] | ||
@@ -66,3 +66,3 @@ }, | ||
| "src": [ | ||
| "./src/absf.c" | ||
| "./src/main.c" | ||
| ], | ||
@@ -75,4 +75,4 @@ "include": [ | ||
| "dependencies": [ | ||
| "@stdlib/number-float32-base-to-word" | ||
| "@stdlib/constants-float32-abs-mask", | ||
| "@stdlib/number-float32-base-to-word" | ||
| ] | ||
@@ -79,0 +79,0 @@ } |
+1
-1
@@ -1,1 +0,1 @@ | ||
| Copyright (c) 2016-2022 The Stdlib Authors. | ||
| Copyright (c) 2016-2023 The Stdlib Authors. |
+19
-18
| { | ||
| "name": "@stdlib/math-base-special-absf", | ||
| "version": "0.0.6", | ||
| "version": "0.1.0", | ||
| "description": "Compute the absolute value of a single-precision floating-point number.", | ||
@@ -43,21 +43,22 @@ "license": "Apache-2.0", | ||
| "dependencies": { | ||
| "@stdlib/math-base-napi-unary": "^0.0.x", | ||
| "@stdlib/number-float32-base-to-word": "^0.0.x", | ||
| "@stdlib/utils-library-manifest": "^0.0.x" | ||
| "@stdlib/constants-float32-abs-mask": "^0.1.0", | ||
| "@stdlib/math-base-napi-unary": "^0.1.0", | ||
| "@stdlib/number-float32-base-to-word": "^0.1.0", | ||
| "@stdlib/utils-library-manifest": "^0.1.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@stdlib/array-float32": "^0.0.x", | ||
| "@stdlib/array-uint32": "^0.0.x", | ||
| "@stdlib/bench": "^0.0.x", | ||
| "@stdlib/constants-float32-ninf": "^0.0.x", | ||
| "@stdlib/constants-float32-pinf": "^0.0.x", | ||
| "@stdlib/math-base-assert-is-nan": "^0.0.x", | ||
| "@stdlib/math-base-assert-is-nanf": "^0.0.x", | ||
| "@stdlib/math-base-assert-is-positive-zerof": "^0.0.x", | ||
| "@stdlib/math-base-special-round": "^0.0.x", | ||
| "@stdlib/random-base-randu": "^0.0.x", | ||
| "@stdlib/utils-try-require": "^0.0.x", | ||
| "@stdlib/array-float32": "^0.1.0", | ||
| "@stdlib/array-uint32": "^0.1.0", | ||
| "@stdlib/bench": "^0.1.0", | ||
| "@stdlib/constants-float32-ninf": "^0.1.0", | ||
| "@stdlib/constants-float32-pinf": "^0.1.0", | ||
| "@stdlib/math-base-assert-is-nan": "^0.1.0", | ||
| "@stdlib/math-base-assert-is-nanf": "^0.1.0", | ||
| "@stdlib/math-base-assert-is-positive-zerof": "^0.1.0", | ||
| "@stdlib/math-base-special-round": "^0.1.0", | ||
| "@stdlib/random-base-randu": "^0.0.8", | ||
| "@stdlib/utils-try-require": "^0.1.0", | ||
| "tape": "git+https://github.com/kgryte/tape.git#fix/globby", | ||
| "istanbul": "^0.4.1", | ||
| "tap-spec": "5.x.x" | ||
| "tap-min": "git+https://github.com/Planeshifter/tap-min.git" | ||
| }, | ||
@@ -97,5 +98,5 @@ "engines": { | ||
| "funding": { | ||
| "type": "patreon", | ||
| "url": "https://www.patreon.com/athan" | ||
| "type": "opencollective", | ||
| "url": "https://opencollective.com/stdlib" | ||
| } | ||
| } |
+27
-15
@@ -21,2 +21,13 @@ <!-- | ||
| <details> | ||
| <summary> | ||
| About stdlib... | ||
| </summary> | ||
| <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> | ||
| <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> | ||
| <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> | ||
| <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> | ||
| </details> | ||
| # Absolute Value | ||
@@ -177,4 +188,4 @@ | ||
| int main() { | ||
| float x[] = { 3.14f, -3.14f, 0.0f, 0.0f/0.0f }; | ||
| int main( void ) { | ||
| const float x[] = { 3.14f, -3.14f, 0.0f, 0.0f/0.0f }; | ||
@@ -206,5 +217,5 @@ float y; | ||
| - <span class="package-name">[`@stdlib/math/base/special/abs`][@stdlib/math/base/special/abs]</span><span class="delimiter">: </span><span class="description">compute the absolute value of a double-precision floating-point number.</span> | ||
| - <span class="package-name">[`@stdlib/math/base/special/abs2f`][@stdlib/math/base/special/abs2f]</span><span class="delimiter">: </span><span class="description">compute the squared absolute value of a single-precision floating-point number.</span> | ||
| - <span class="package-name">[`@stdlib/math/base/special/labs`][@stdlib/math/base/special/labs]</span><span class="delimiter">: </span><span class="description">compute an absolute value of a signed 32-bit integer.</span> | ||
| - <span class="package-name">[`@stdlib/math-base/special/abs`][@stdlib/math/base/special/abs]</span><span class="delimiter">: </span><span class="description">compute the absolute value of a double-precision floating-point number.</span> | ||
| - <span class="package-name">[`@stdlib/math-base/special/abs2f`][@stdlib/math/base/special/abs2f]</span><span class="delimiter">: </span><span class="description">compute the squared absolute value of a single-precision floating-point number.</span> | ||
| - <span class="package-name">[`@stdlib/math-base/special/labs`][@stdlib/math/base/special/labs]</span><span class="delimiter">: </span><span class="description">compute an absolute value of a signed 32-bit integer.</span> | ||
@@ -241,3 +252,3 @@ </section> | ||
| Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. | ||
| Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. | ||
@@ -255,4 +266,4 @@ </section> | ||
| [test-image]: https://github.com/stdlib-js/math-base-special-absf/actions/workflows/test.yml/badge.svg | ||
| [test-url]: https://github.com/stdlib-js/math-base-special-absf/actions/workflows/test.yml | ||
| [test-image]: https://github.com/stdlib-js/math-base-special-absf/actions/workflows/test.yml/badge.svg?branch=v0.1.0 | ||
| [test-url]: https://github.com/stdlib-js/math-base-special-absf/actions/workflows/test.yml?query=branch:v0.1.0 | ||
@@ -269,2 +280,9 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-special-absf/main.svg | ||
| [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg | ||
| [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im | ||
| [stdlib]: https://github.com/stdlib-js/stdlib | ||
| [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors | ||
| [umd]: https://github.com/umdjs/umd | ||
@@ -276,10 +294,4 @@ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules | ||
| [esm-url]: https://github.com/stdlib-js/math-base-special-absf/tree/esm | ||
| [branches-url]: https://github.com/stdlib-js/math-base-special-absf/blob/main/branches.md | ||
| [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg | ||
| [chat-url]: https://gitter.im/stdlib-js/stdlib/ | ||
| [stdlib]: https://github.com/stdlib-js/stdlib | ||
| [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors | ||
| [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/math-base-special-absf/main/LICENSE | ||
@@ -286,0 +298,0 @@ |
| {{alias}}( x ) | ||
| Computes the absolute value of a single-precision floating-point number `x`. | ||
| Parameters | ||
| ---------- | ||
| x: number | ||
| Input value. | ||
| Returns | ||
| ------- | ||
| y: number | ||
| Absolute value. | ||
| Examples | ||
| -------- | ||
| > var y = {{alias}}( -1.0 ) | ||
| 1.0 | ||
| > y = {{alias}}( 2.0 ) | ||
| 2.0 | ||
| > y = {{alias}}( 0.0 ) | ||
| 0.0 | ||
| > y = {{alias}}( -0.0 ) | ||
| 0.0 | ||
| > y = {{alias}}( NaN ) | ||
| NaN | ||
| See Also | ||
| -------- | ||
| /* | ||
| * @license Apache-2.0 | ||
| * | ||
| * Copyright (c) 2020 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. | ||
| */ | ||
| import absf = require( './index' ); | ||
| // TESTS // | ||
| // The function returns a number... | ||
| { | ||
| absf( 8 ); // $ExpectType number | ||
| } | ||
| // The function does not compile if provided a value other than a number... | ||
| { | ||
| absf( true ); // $ExpectError | ||
| absf( false ); // $ExpectError | ||
| absf( null ); // $ExpectError | ||
| absf( undefined ); // $ExpectError | ||
| absf( '5' ); // $ExpectError | ||
| absf( [] ); // $ExpectError | ||
| absf( {} ); // $ExpectError | ||
| absf( ( x: number ): number => x ); // $ExpectError | ||
| } | ||
| // The function does not compile if provided insufficient arguments... | ||
| { | ||
| absf(); // $ExpectError | ||
| } |
-40
| /** | ||
| * @license Apache-2.0 | ||
| * | ||
| * Copyright (c) 2020 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. | ||
| */ | ||
| #include "stdlib/math/base/special/absf.h" | ||
| #include "stdlib/number/float32/base/to_word.h" | ||
| // 0x7fffffff = 2147483647 => 0 11111111111 11111111111111111111 | ||
| static const uint32_t ABS_MASK = 2147483647; | ||
| /** | ||
| * Computes the absolute value of a single-precision floating-point number. | ||
| * | ||
| * @param x number | ||
| * @return absolute value | ||
| * | ||
| * @example | ||
| * float y = stdlib_base_absf( -5.0f ); | ||
| * // returns 5.0f | ||
| */ | ||
| float stdlib_base_absf( const float x ) { | ||
| stdlib_base_float32_word_t w; | ||
| w.value = x; | ||
| w.word &= ABS_MASK; | ||
| return w.value; | ||
| } |
Mixed license
LicensePackage contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
19
11.76%0
-100%307
4.07%44476
-18.83%4
33.33%337
-7.67%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed