Jump to content


Photo

prob using math operator


  • Please log in to reply
1 reply to this topic

#1 silver32

silver32
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 30 July 2006 - 02:05 PM

$xpfornext = 4000
$Level[7] =  2000
$per = $xpfornext - $Level[7] / $xpfornext * 100;
I always get a 3999.5 but I must be gettting 50, what's the problem and can you suggest any easier/other ways to calculate the percentage.

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 30 July 2006 - 02:51 PM

Take a closer look at your logic and you'll see why you need to change it to this:

$per = $xpfornext - 100 * $level[7] / $xpfornext;

Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users