Skip to content

Commit

Permalink
Bug fix: M.g() loses precision after 13 or so
Browse files Browse the repository at this point in the history
  • Loading branch information
ETHproductions committed Jan 4, 2017
1 parent 1391f7b commit 21099db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/japt-interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Date.p = Date.parse;

// Shorter Math properties
Math.a = Math.atan2;
Math.g = function(n){var f=Math.sqrt(5),g=.5*(1+f);return(1/f)*(Math.pow(g,n)-Math.pow(-g,-n))}; // Fibonacci
Math.g = function(n){var f=Math.sqrt(5),g=.5*(1+f);return Math.round((1/f)*(Math.pow(g,n)-Math.pow(-g,-n)))}; // Fibonacci
Math.r = function(x,y){x=fb(x,1);y=fb(y,0);return Math.random()*x+y};
Math.q = function(x,y,z){x=fb(x,1);y=fb(y,0);z=fb(z,1);return Math.floor(Math.random()*x*z)/z+y};
Math.s = Math.sin;
Expand Down

0 comments on commit 21099db

Please sign in to comment.