Exemplo n.º 1
0
 function testdiscountRate()
 {
     // various random calculations
     $this->assertTrue(abs(0.052071 - Math_Finance::discountRate(mktime(0, 0, 0, 1, 25, 2007), mktime(0, 0, 0, 6, 15, 2007), 97.97499999999999, 100, FINANCE_COUNT_NASD)) < FINANCE_PRECISION);
     $this->assertTrue(abs(0.05242 - Math_Finance::discountRate(mktime(0, 0, 0, 1, 25, 2007), mktime(0, 0, 0, 6, 15, 2007), 97.97499999999999, 100, FINANCE_COUNT_ACTUAL_ACTUAL)) < FINANCE_PRECISION);
     $this->assertTrue(abs(0.051702 - Math_Finance::discountRate(mktime(0, 0, 0, 1, 25, 2007), mktime(0, 0, 0, 6, 15, 2007), 97.97499999999999, 100, FINANCE_COUNT_ACTUAL_360)) < FINANCE_PRECISION);
     $this->assertTrue(abs(0.05242 - Math_Finance::discountRate(mktime(0, 0, 0, 1, 25, 2007), mktime(0, 0, 0, 6, 15, 2007), 97.97499999999999, 100, FINANCE_COUNT_ACTUAL_365)) < FINANCE_PRECISION);
     $this->assertTrue(abs(0.052071 - Math_Finance::discountRate(mktime(0, 0, 0, 1, 25, 2007), mktime(0, 0, 0, 6, 15, 2007), 97.97499999999999, 100, FINANCE_COUNT_EUROPEAN)) < FINANCE_PRECISION);
 }