
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
@stdlib/math-base-special-cabs
Advanced tools
Compute an absolute value of a complex number.
The absolute value of a complex number is defined as
which corresponds to the length of a vector from the origin to a complex value plotted in the complex plane.
npm install @stdlib/math-base-special-cabs
var cabs = require( '@stdlib/math-base-special-cabs' );
Computes an absolute value of a complex number comprised of a real component re and an imaginary component im.
var y = cabs( 5.0, 3.0 );
// returns ~5.83
var Complex128 = require( '@stdlib/complex-float64' );
var randu = require( '@stdlib/random-base-randu' );
var round = require( '@stdlib/math-base-special-round' );
var real = require( '@stdlib/complex-real' );
var imag = require( '@stdlib/complex-imag' );
var cabs = require( '@stdlib/math-base-special-cabs' );
var re;
var im;
var z;
var i;
for ( i = 0; i < 100; i++ ) {
re = round( randu()*100.0 ) - 50.0;
im = round( randu()*100.0 ) - 50.0;
z = new Complex128( re, im );
console.log( 'cabs(%s) = %d', z.toString(), cabs( real(z), imag(z) ) );
}
This package is part of 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.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
See LICENSE.
Copyright © 2016-2021. The Stdlib Authors.
FAQs
Compute the absolute value of a double-precision complex floating-point number.
The npm package @stdlib/math-base-special-cabs receives a total of 47 weekly downloads. As such, @stdlib/math-base-special-cabs popularity was classified as not popular.
We found that @stdlib/math-base-special-cabs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.