Skip to content

Commit

Permalink
Update ComplexNumber.js
Browse files Browse the repository at this point in the history
  • Loading branch information
MAZ01001 committed Aug 1, 2024
1 parent d158dfe commit 465d86a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions ComplexNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,13 +648,10 @@ const ComplexNumber=class ComplexNumber{
* @throws {TypeError} if {@linkcode n} is not a non-zero safe integer
* @returns {Generator<ComplexNumber,void,unknown>} generator giving a list of newly created complex numbers (ordered counterclockwise from positive real axis - assume the first element is the "positive" root ie. principal root)
* @example
* new ComplexNumber(2,0).pow(-4).roots(-4).next().value
* ?.roundEpsilon().toString()??"no root";
* "2+0i";
*
* [...new ComplexNumber(2,0).pow(-4).roots(-4)]
* .map(v=>v.roundEpsilon().toString());
* ["2+0i", "0+2i", "-2+0i", "0-2i"];
* new ComplexNumber(2,0).pow(-4).roots(-4).next().value?.roundEpsilon().toString()??"no root";
* //=> "2+0i"
* [...new ComplexNumber(2,0).pow(-4).roots(-4)].map(v=>v.roundEpsilon().toString());
* //=> ["2+0i", "0+2i", "-2+0i", "0-2i"]
*/
*roots(n){
if(!Number.isSafeInteger(n)||n===0)throw new TypeError("[root] n is not a non-zero safe integer.");
Expand Down

0 comments on commit 465d86a

Please sign in to comment.