Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmasson committed Nov 28, 2024
1 parent 37061d4 commit ffdb079
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions build/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -1152,8 +1152,10 @@ function fundamentalParallelogram( x, p1, p2 ) {

// x = m p1 + n p2, solve for m, n

var m = ( x.re * p2.im - x.im * p2.re ) / ( p1.re * p2.im - p1.im * p2.re );
var n = ( x.im * p1.re - x.re * p1.im ) / ( p1.re * p2.im - p1.im * p2.re );
var det = p1.re * p2.im - p1.im * p2.re;

var m = ( x.re * p2.im - x.im * p2.re ) / det;
var n = ( x.im * p1.re - x.re * p1.im ) / det;

return add( x, mul( -Math.floor(m), p1 ), mul( -Math.floor(n), p2 ) );

Expand Down
6 changes: 4 additions & 2 deletions src/functions/elliptic-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ function fundamentalParallelogram( x, p1, p2 ) {

// x = m p1 + n p2, solve for m, n

var m = ( x.re * p2.im - x.im * p2.re ) / ( p1.re * p2.im - p1.im * p2.re );
var n = ( x.im * p1.re - x.re * p1.im ) / ( p1.re * p2.im - p1.im * p2.re );
var det = p1.re * p2.im - p1.im * p2.re;

var m = ( x.re * p2.im - x.im * p2.re ) / det;
var n = ( x.im * p1.re - x.re * p1.im ) / det;

return add( x, mul( -Math.floor(m), p1 ), mul( -Math.floor(n), p2 ) );

Expand Down

0 comments on commit ffdb079

Please sign in to comment.