scijs/complex-modulus

Name: complex-modulus

Owner: scijs

Description: Floating point complex modulus

Created: 2015-05-11 08:12:38.0

Updated: 2016-06-05 16:07:05.0

Pushed: 2016-06-05 16:07:04.0

Homepage: null

Size: 15

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

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]](#references) is:

Complex modulus

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

Calculates |a + ib| and returns a number

Example
cmod = require('complex-modulus');

result = cmod( 3, 4 );

esult = 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


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.