Skip to content

Commit

Permalink
fix (expt +i +i) #333
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Mar 9, 2024
1 parent bc02330 commit e26612f
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![npm](https://img.shields.io/badge/npm-1.0.0%E2%80%93beta.18.1-blue.svg)](https://www.npmjs.com/package/@jcubic/lips)
![1.0.0 Complete](https://img.shields.io/github/milestones/progress-percent/jcubic/lips/1?label=1.0.0%20Complete)
[![Build and test](https://github.com/jcubic/lips/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/lips/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&2d726da5d9fc6d26e6724add645f1917)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&6740a8c4f530e7da9705d4912c8d9ee3)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Join Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jcubic/lips)
![NPM Download Count](https://img.shields.io/npm/dm/@jcubic/lips)
![JSDelivr Download count](https://img.shields.io/jsdelivr/npm/hm/@jcubic/lips)
Expand Down
12 changes: 8 additions & 4 deletions dist/lips.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions dist/lips.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.esm.min.js

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions dist/lips.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -5784,6 +5784,9 @@ LComplex.prototype.pow = function(n) {
// Complex exponent of a complex numbers
// equation taken from https://math.stackexchange.com/a/476998/31117
let p = n.mul(Math.log(magnitude.valueOf())).add(LComplex.i.mul(angle).mul(n));
if (!LNumber.isComplex(p)) {
return LFloat(Math.E).pow(p);
}
const e = LFloat(Math.E).pow(p.__re__.valueOf());
return LComplex({
re: e.mul(Math.cos(p.__im__.valueOf())),
Expand Down
2 changes: 2 additions & 0 deletions tests/numbers.scm
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,8 @@
(t.is (expt 10+10i 0.5) 3.4743442276011565+1.4391204994250744i)
(t.is (expt 10+10i -0.5) 0.24567323635131155-0.1017611864088041i)

(t.is (expt +i +i) 0.20787957635076193) ;; #333

(t.is (expt 2 10+10i) 816.2504880317307+618.3131413676737i)
(t.is (expt -2 10+10i) 1.8537873553889387e-11+1.4042516359189482e-11i)
(t.is (expt 1/2 10+10i) 7.784371261899293e-4-5.896693624188176e-4i)
Expand Down

0 comments on commit e26612f

Please sign in to comment.