Thread: Math!
View Single Post
  #10  
Old 05-28-2006, 05:51 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by excaliber7388
PHP Code:
function calc_subtract.onAction()
{
  
// stuff
  
this.total-=temp.display;
  
// stuff
}
function 
calc_multiply.onAction()
{
  
// stuff
  
this.total*=temp.display;
  
// stuff
}
function 
calc_divide.onAction()
{
  
// stuff
  
this.total/=temp.display;
  
// stuff

I can't be sure, but it seems to me that the probem lies in these actions. I am supposing that these are to set the first number. In which case,
NPC Code:
this.total-=temp.display
this.total*=temp.display
this.total/=temp.display


should be
NPC Code:
this.total = temp.display



It seems to me what you are actually doing is
0 + 8 + 6 = 14 <- is correct
0 - 8 - 6 = -14
0 * 8 * 6 = 0
0 / 8 / 6 = 0

Last edited by Tolnaftate2004; 05-28-2006 at 06:02 PM..
Reply With Quote