Author Topic: How does TD2 calculate points formula with log? [Solved]  (Read 647 times)

rakrul

  • Newbie
  • *
  • Posts: 24
    • View Profile
How does TD2 calculate points formula with log? [Solved]
« on: February 20, 2014, 08:49:05 PM »
Hi.

I'm using 2.5.14 and my points formula is: (log(n/r))*n
Testing it, I get this result (with 6 players):
1st, 6, 10.75
2nd, 5, 6.59
3rd, 4, 4.16
4th, 3, 2.43
5th, 2, 1.09
6th, 1, 0.00

Which is the score I'm looking for, however when I check the formula with a calculator or Excel, I get a completely different result. Let's take 1st place as an example;
(Log (6/1)) * 6
(Log (6)) * 6
0.78 * 6 = 4.67

So how exactly is TD2 calculating my formula to reach 10.75?
« Last Edit: February 21, 2014, 07:18:37 AM by rakrul »

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5420
    • View Profile
Re: How does TD2 calculate points formula with log?
« Reply #1 on: February 20, 2014, 09:18:57 PM »
The TD has two functions: log() and log10().  The log() function calculates log base E, while the log10() function calculates log base 10.  Your calculator and Excel assume log base 10.  That's why you get different results.

For your example, log(6/1) * 6 = 10.75, but log10(6/1) * 6 = 4.67.

The TD's log() function actually takes an optional additional parameter, which is the base.  So log(6, 10) is equivalent to log10(6).

rakrul

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: How does TD2 calculate points formula with log?
« Reply #2 on: February 21, 2014, 07:18:13 AM »
Ah got it. Thanks again for the help.