Narcissistic Pickle Meister
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

complex-modulus

1.0.1 • Public • Published

complex-modulus

Build Status npm version Dependency Status

Floating point complex modulus

Intro

Calculating a floating point complex modulus isn't quite trivial. The naive method may encounter overflow, underflow, or loss of precision due to the intermediate floating point results. A simple remedy[1] is:

Complex modulus

Usage

require('complex-modulus')( a, b )

Calculates |a + ib| and returns a number

Example

var cmod = require('complex-modulus');
 
var result = cmod( 3, 4 );
 
// result = 5

References

[1] Press, William H. Numerical Recipes 3rd Edition: The Art of Scientific Computing. Cambridge University Press, 2007.

Credits

(c) 2015 Ricky Reusser. MIT License

install

npm i complex-modulus

Downloadsweekly downloads

1

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar