sloisel / numeric

Numerical analysis in Javascript
http://www.numericjs.com/
Other
1.42k stars 176 forks source link

Fix reciprocal of a complex number with zero imaginary part. #59

Open gagern opened 9 years ago

gagern commented 9 years ago

The reciprocal function is broken when applied to a complex number with zero imaginary part. The code path forgot to use a namespace for the result, and also forgot to include the imaginary part of the result. I added a suitable test case to the documentation to check for this. The missing namespace was found by jshint, the missing imaginary part then exposed by the unit test I had added.