|
|
|
|
|
by omra
4985 days ago
|
|
Interesting! I decided to do some detective work and find out why. I found this: http://imkevinxu.com/xkcd/parser.js, and thought that maybe if I knew how the strings were parsed, I could figure out why it was doing that. $ string_eval("x*x1")
"x*x1"
I figured that the issue must be with the equation drawing or evaluated. Here's what I found as an inline script (note that i is points at which the function is evaluated): current_expression = expression.split("-x").join(-i);
var result = eval(current_expression.split("x").join(i));
So it just splits up the equation and rejoins it. From here it was pretty easy to see what was happening: $ expression = string_eval("x*x1");
"x*x1"
$ expression.split("x").join(12);
"12*121"
$ expression.split("x").join(3);
"3*31"
$ expression.split("x").join(0.3);
"0.3*0.31"
$ expression.split("x").join(-3);
"-3*-31"
|
|
Just pushed the bug fix, should work now! Hacker News is awesome, thanks :)