Complex math in JavaScript

3 views
Skip to first unread message

Michael Egbert

unread,
Oct 20, 2011, 4:00:23 PM10/20/11
to colaco...@googlegroups.com

Do you guys know of any javascript interpreter capable of going through trillions of loops?   I'm working on the 3rd euler problem and I have the right code, it's just that it crashes chrome when I enter large numbers.

Sean Copenhaver

unread,
Oct 20, 2011, 4:03:12 PM10/20/11
to colaco...@googlegroups.com
Hmm... but why is it crashing. Memory? Too long of a computation (some browsers have hard limits on the amount of instructions you can run while blocking the UI)? Bug in the runtime? You could enter a huge number and try to take a profile snapshot after it runs for awhile just to see.

Try running your script in a web worker. Maybe try node.js.

On Thu, Oct 20, 2011 at 4:00 PM, Michael Egbert <egbe...@gmail.com> wrote:

Do you guys know of any javascript interpreter capable of going through trillions of loops?   I'm working on the 3rd euler problem and I have the right code, it's just that it crashes chrome when I enter large numbers.

--
You received this message because you are subscribed to the Google
Groups "ColaCodeDojo" group.
To post to this group, send email to colaco...@googlegroups.com
To unsubscribe from this group, send email to
colacodedojo...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/colacodedojo?hl=en



--
“The limits of language are the limits of one's world. “ - Ludwig von Wittgenstein

"Water is fluid, soft and yielding. But water will wear away rock, which is rigid and cannot yield. As a rule, whatever is fluid, soft and yielding will overcome whatever is rigid and hard. This is another paradox: what is soft is strong." - Lao-Tzu


Michael Egbert

unread,
Oct 20, 2011, 4:21:50 PM10/20/11
to colaco...@googlegroups.com

Without the conditional breaks and continues to ease up on performance this function would loop through 600 billion squared steps.   I guess I should find a different algorithm, heh

jed schneider

unread,
Oct 20, 2011, 7:57:59 PM10/20/11
to colaco...@googlegroups.com
how about a prime sieve?

-- 
jed schneider
Sent with Sparrow
Reply all
Reply to author
Forward
0 new messages