@stdlib/math-base-special-cabs
Advanced tools
+1
-1
| "use strict";var a=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var t=a(function(v,i){ | ||
| var u=require('@stdlib/math-base-special-hypot/dist'),s=require('@stdlib/complex-real/dist'),c=require('@stdlib/complex-imag/dist');function n(r){return u(s(r),c(r))}i.exports=n | ||
| var u=require('@stdlib/math-base-special-hypot/dist'),s=require('@stdlib/complex-float64-real/dist'),c=require('@stdlib/complex-float64-imag/dist');function n(r){return u(s(r),c(r))}i.exports=n | ||
| });var o=t();module.exports=o; | ||
| /** @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) 2018 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 hypot = require( '@stdlib/math-base-special-hypot' );\nvar real = require( '@stdlib/complex-real' );\nvar imag = require( '@stdlib/complex-imag' );\n\n\n// MAIN //\n\n/**\n* Computes the absolute value of a double-precision complex floating-point number.\n*\n* @param {Complex128} z - complex number\n* @returns {number} absolute value\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64' );\n*\n* var v = cabs( new Complex128( 5.0, 3.0 ) );\n* // returns ~5.83\n*/\nfunction cabs( z ) {\n\t// TODO: consider whether to use C99 rules for special cases involving infinities and nans (see https://github.com/python/cpython/blob/f4c03484da59049eb62a9bf7777b963e2267d187/Objects/complexobject.c#L191)\n\treturn hypot( real( z ), imag( z ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cabs;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 absolute value of a double-precision complex floating-point number.\n*\n* @module @stdlib/math-base-special-cabs\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64' );\n* var cabs = require( '@stdlib/math-base-special-cabs' );\n*\n* var v = cabs( new Complex128( 5.0, 3.0 ) );\n* // returns ~5.83\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,cAsBA,IAAIC,EAAQ,QAAS,iCAAkC,EACnDC,EAAO,QAAS,sBAAuB,EACvCC,EAAO,QAAS,sBAAuB,EAiB3C,SAASC,EAAMC,EAAI,CAElB,OAAOJ,EAAOC,EAAMG,CAAE,EAAGF,EAAME,CAAE,CAAE,CACpC,CAKAL,EAAO,QAAUI,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", | ||
| "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hypot = require( '@stdlib/math-base-special-hypot' );\nvar real = require( '@stdlib/complex-float64-real' );\nvar imag = require( '@stdlib/complex-float64-imag' );\n\n\n// MAIN //\n\n/**\n* Computes the absolute value of a double-precision complex floating-point number.\n*\n* @param {Complex128} z - complex number\n* @returns {number} absolute value\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n*\n* var v = cabs( new Complex128( 5.0, 3.0 ) );\n* // returns ~5.83\n*/\nfunction cabs( z ) {\n\t// TODO: consider whether to use C99 rules for special cases involving infinities and nans (see https://github.com/python/cpython/blob/f4c03484da59049eb62a9bf7777b963e2267d187/Objects/complexobject.c#L191)\n\treturn hypot( real( z ), imag( z ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cabs;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 absolute value of a double-precision complex floating-point number.\n*\n* @module @stdlib/math-base-special-cabs\n*\n* @example\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var cabs = require( '@stdlib/math-base-special-cabs' );\n*\n* var v = cabs( new Complex128( 5.0, 3.0 ) );\n* // returns ~5.83\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,cAsBA,IAAIC,EAAQ,QAAS,iCAAkC,EACnDC,EAAO,QAAS,8BAA+B,EAC/CC,EAAO,QAAS,8BAA+B,EAiBnD,SAASC,EAAMC,EAAI,CAElB,OAAOJ,EAAOC,EAAMG,CAAE,EAAGF,EAAME,CAAE,CAAE,CACpC,CAKAL,EAAO,QAAUI,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", | ||
| "names": ["require_main", "__commonJSMin", "exports", "module", "hypot", "real", "imag", "cabs", "z", "main"] | ||
| } |
@@ -36,3 +36,3 @@ /* | ||
| * @example | ||
| * var Complex128 = require( '@stdlib/complex-float64' ); | ||
| * var Complex128 = require( '@stdlib/complex-float64-ctor' ); | ||
| * | ||
@@ -39,0 +39,0 @@ * var v = cabs( new Complex128( 5.0, 3.0 ) ); |
@@ -22,3 +22,3 @@ /** | ||
| #include "stdlib/complex/float64.h" | ||
| #include "stdlib/complex/float64/ctor.h" | ||
@@ -25,0 +25,0 @@ /* |
+1
-1
@@ -27,3 +27,3 @@ /** | ||
| * @example | ||
| * var Complex128 = require( '@stdlib/complex-float64' ); | ||
| * var Complex128 = require( '@stdlib/complex-float64-ctor' ); | ||
| * var cabs = require( '@stdlib/math-base-special-cabs' ); | ||
@@ -30,0 +30,0 @@ * |
+3
-3
@@ -24,4 +24,4 @@ /** | ||
| var hypot = require( '@stdlib/math-base-special-hypot' ); | ||
| var real = require( '@stdlib/complex-real' ); | ||
| var imag = require( '@stdlib/complex-imag' ); | ||
| var real = require( '@stdlib/complex-float64-real' ); | ||
| var imag = require( '@stdlib/complex-float64-imag' ); | ||
@@ -38,3 +38,3 @@ | ||
| * @example | ||
| * var Complex128 = require( '@stdlib/complex-float64' ); | ||
| * var Complex128 = require( '@stdlib/complex-float64-ctor' ); | ||
| * | ||
@@ -41,0 +41,0 @@ * var v = cabs( new Complex128( 5.0, 3.0 ) ); |
+1
-1
@@ -36,3 +36,3 @@ /** | ||
| * @example | ||
| * var Complex128 = require( '@stdlib/complex-float64' ); | ||
| * var Complex128 = require( '@stdlib/complex-float64-ctor' ); | ||
| * | ||
@@ -39,0 +39,0 @@ * var v = cabs( new Complex128( 5.0, 3.0 ) ); |
+6
-6
@@ -40,4 +40,4 @@ { | ||
| "@stdlib/math-base-napi-unary", | ||
| "@stdlib/complex-float64", | ||
| "@stdlib/complex-reim", | ||
| "@stdlib/complex-float64-ctor", | ||
| "@stdlib/complex-float64-reim", | ||
| "@stdlib/math-base-special-hypot" | ||
@@ -57,4 +57,4 @@ ] | ||
| "dependencies": [ | ||
| "@stdlib/complex-float64", | ||
| "@stdlib/complex-reim", | ||
| "@stdlib/complex-float64-ctor", | ||
| "@stdlib/complex-float64-reim", | ||
| "@stdlib/math-base-special-hypot" | ||
@@ -74,4 +74,4 @@ ] | ||
| "dependencies": [ | ||
| "@stdlib/complex-float64", | ||
| "@stdlib/complex-reim", | ||
| "@stdlib/complex-float64-ctor", | ||
| "@stdlib/complex-float64-reim", | ||
| "@stdlib/math-base-special-hypot" | ||
@@ -78,0 +78,0 @@ ] |
+7
-7
| { | ||
| "name": "@stdlib/math-base-special-cabs", | ||
| "version": "0.2.1", | ||
| "version": "0.2.2", | ||
| "description": "Compute the absolute value of a double-precision complex floating-point number.", | ||
@@ -36,9 +36,9 @@ "license": "Apache-2.0", | ||
| "dependencies": { | ||
| "@stdlib/complex-float64": "^0.2.1", | ||
| "@stdlib/complex-imag": "^0.2.1", | ||
| "@stdlib/complex-real": "^0.2.1", | ||
| "@stdlib/complex-reim": "^0.2.1", | ||
| "@stdlib/math-base-napi-unary": "^0.2.1", | ||
| "@stdlib/complex-float64-ctor": "^0.0.3", | ||
| "@stdlib/complex-float64-imag": "^0.1.1", | ||
| "@stdlib/complex-float64-real": "^0.1.1", | ||
| "@stdlib/complex-float64-reim": "^0.1.2", | ||
| "@stdlib/math-base-napi-unary": "^0.2.3", | ||
| "@stdlib/math-base-special-hypot": "^0.2.1", | ||
| "@stdlib/utils-library-manifest": "^0.2.1" | ||
| "@stdlib/utils-library-manifest": "^0.2.2" | ||
| }, | ||
@@ -45,0 +45,0 @@ "devDependencies": {}, |
+12
-12
@@ -36,7 +36,7 @@ <!-- | ||
| > Compute the [absolute value][absolute-value] of a double-precision [complex][@stdlib/complex/float64] floating-point number. | ||
| > Compute the [absolute value][absolute-value] of a double-precision [complex][@stdlib/complex/float64/ctor] floating-point number. | ||
| <section class="intro"> | ||
| The [absolute value][absolute-value] of a [complex][@stdlib/complex/float64] number is defined as | ||
| The [absolute value][absolute-value] of a [complex][@stdlib/complex/float64/ctor] number is defined as | ||
@@ -78,6 +78,6 @@ <!-- <equation class="equation" label="eq:absolute_value_complex" align="center" raw="|a + bi| = \sqrt{a^2 + b^2}" alt="Absolute value"> --> | ||
| Computes an [absolute value][absolute-value] of a double-precision [complex][@stdlib/complex/float64] floating-point number. | ||
| Computes an [absolute value][absolute-value] of a double-precision [complex][@stdlib/complex/float64/ctor] floating-point number. | ||
| ```javascript | ||
| var Complex128 = require( '@stdlib/complex-float64' ); | ||
| var Complex128 = require( '@stdlib/complex-float64-ctor' ); | ||
@@ -101,3 +101,3 @@ var y = cabs( new Complex128( 5.0, 3.0 ) ); | ||
| ```javascript | ||
| var Complex128 = require( '@stdlib/complex-float64' ); | ||
| var Complex128 = require( '@stdlib/complex-float64-ctor' ); | ||
| var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); | ||
@@ -149,3 +149,3 @@ var cabs = require( '@stdlib/math-base-special-cabs' ); | ||
| ```c | ||
| #include "stdlib/complex/float64.h" | ||
| #include "stdlib/complex/float64/ctor.h" | ||
@@ -186,4 +186,4 @@ stdlib_complex128_t z = stdlib_complex128( 5.0, 3.0 ); | ||
| #include "stdlib/math/base/special/cabs.h" | ||
| #include "stdlib/complex/float64.h" | ||
| #include "stdlib/complex/reim.h" | ||
| #include "stdlib/complex/float64/ctor.h" | ||
| #include "stdlib/complex/float64/reim.h" | ||
| #include <stdio.h> | ||
@@ -207,3 +207,3 @@ | ||
| y = stdlib_base_cabs( v ); | ||
| stdlib_reim( v, &re, &im ); | ||
| stdlib_complex128_reim( v, &re, &im ); | ||
| printf( "f(%lf + %lf) = %lf\n", re, im, y ); | ||
@@ -276,4 +276,4 @@ } | ||
| [test-image]: https://github.com/stdlib-js/math-base-special-cabs/actions/workflows/test.yml/badge.svg?branch=v0.2.1 | ||
| [test-url]: https://github.com/stdlib-js/math-base-special-cabs/actions/workflows/test.yml?query=branch:v0.2.1 | ||
| [test-image]: https://github.com/stdlib-js/math-base-special-cabs/actions/workflows/test.yml/badge.svg?branch=v0.2.2 | ||
| [test-url]: https://github.com/stdlib-js/math-base-special-cabs/actions/workflows/test.yml?query=branch:v0.2.2 | ||
@@ -312,3 +312,3 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-special-cabs/main.svg | ||
| [@stdlib/complex/float64]: https://www.npmjs.com/package/@stdlib/complex-float64 | ||
| [@stdlib/complex/float64/ctor]: https://www.npmjs.com/package/@stdlib/complex-float64-ctor | ||
@@ -315,0 +315,0 @@ <!-- <related-links> --> |
+4
-4
@@ -21,4 +21,4 @@ /** | ||
| #include "stdlib/math/base/special/hypot.h" | ||
| #include "stdlib/complex/float64.h" | ||
| #include "stdlib/complex/reim.h" | ||
| #include "stdlib/complex/float64/ctor.h" | ||
| #include "stdlib/complex/float64/reim.h" | ||
@@ -32,3 +32,3 @@ /** | ||
| * @example | ||
| * #include "stdlib/complex/float64.h" | ||
| * #include "stdlib/complex/float64/ctor.h" | ||
| * | ||
@@ -43,4 +43,4 @@ * stdlib_complex128_t z = stdlib_complex128( 5.0, 3.0 ); | ||
| double im; | ||
| stdlib_reim( z, &re, &im ); | ||
| stdlib_complex128_reim( z, &re, &im ); | ||
| return stdlib_base_hypot( re, im ); | ||
| } |
Sorry, the diff of this file is not supported yet
39527
-4.7%17
-5.56%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed