Skip to content

Commit

Permalink
add complex numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
monishcm committed Apr 8, 2024
1 parent 111a196 commit 7e5732e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@monishcm-jsr/hello-jsr",
"version": "0.1.5",
"version": "0.1.6",
"exports": "./mod.ts"
}
12 changes: 12 additions & 0 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*
*/

import * as complex from 'complex';

/**
*
* @param a first number
Expand Down Expand Up @@ -51,4 +53,14 @@ export function divide(a: number, b: number): number {
throw new Error("Cannot divide by zero");
}
return a / b;
}

/**
*
* @param a first complex number
* @param b second complex number
* @returns addition of a and b
*/
export function complexAdd(a: complex, b: complex): complex {
return complex.add(a, b);
}

0 comments on commit 7e5732e

Please sign in to comment.