Skip to content

Commit

Permalink
Code speed up
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmasson committed Oct 15, 2020
1 parent a13f7ef commit 1b72347
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions build/mathcell.js
Original file line number Diff line number Diff line change
Expand Up @@ -1735,9 +1735,9 @@ var colormaps = Object.assign( {}, matplotlib, mathematica );

function checkValue( x ) {

// denominator must be greater than rounding decimal places downstream
if ( x === Infinity ) return Number.MAX_VALUE / 1e5;
if ( x === -Infinity ) return -Number.MAX_VALUE / 1e5;
// be aware of rounding decimal places downstream
if ( x === Infinity ) return 1e300;
if ( x === -Infinity ) return -1e300;

if ( isNaN(x) ) {
console.log( 'NaN converted to zero while plotting' );
Expand Down
6 changes: 3 additions & 3 deletions src/plot/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

function checkValue( x ) {

// denominator must be greater than rounding decimal places downstream
if ( x === Infinity ) return Number.MAX_VALUE / 1e5;
if ( x === -Infinity ) return -Number.MAX_VALUE / 1e5;
// be aware of rounding decimal places downstream
if ( x === Infinity ) return 1e300;
if ( x === -Infinity ) return -1e300;

if ( isNaN(x) ) {
console.log( 'NaN converted to zero while plotting' );
Expand Down

0 comments on commit 1b72347

Please sign in to comment.