User talk:Seen

From NetHackWiki
Jump to: navigation, search

Is this the problem (with the Javascript Casting Failure Calculator)?

The following seems to fix the problem for me:

--- /tmp/casting.html.orig 2006-09-08 20:40:15.000000000 -0700
+++ /tmp/casting.html 2006-09-08 20:53:48.000000000 -0700
@@ -48,7 +48,7 @@
     var chance = basechance - Math.floor(Math.sqrt(900 * diff + 2000));
   else
   {
-    var learning = 15 * Math.floor(-diff / slevel);
+    var learning = Math.floor(((-15) * diff) / slevel);
     var chance = basechance + Math.min(learning, 20);
   }
   // limit to the 0-120 range

Since multiplication and division are left associative in C, the multiplication is performed before the division and its implied rounding; this gives the computation slightly more precision than it would have if the division and rounding were done first. --Stefanor 05:47, 9 September 2006 (UTC)