Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit 54fd992

Browse files
author
Stefan Majoor
committed
tests for sinus
1 parent 1d39411 commit 54fd992

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/Decimal/DecimalSinTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use Litipk\BigNumbers\Decimal as Decimal;
4+
5+
/**
6+
* @group sin
7+
*/
8+
class DecimalSinTest extends PHPUnit_Framework_TestCase
9+
{
10+
public function sinProvider() {
11+
// Some values providede by mathematica
12+
return array(
13+
array('1', '0.84147098480790', '14'),
14+
array('123.123', '-0.56537391969733569', '17'),
15+
array('15000000000', '0.69170450164193502844', '20')
16+
17+
);
18+
}
19+
20+
/**
21+
* @dataProvider sinProvider
22+
*/
23+
public function testSimple($nr, $answer, $digits)
24+
{
25+
$x = Decimal::fromString($nr);
26+
$sinX = $x->sin($digits);
27+
$this->assertTrue(Decimal::fromString($answer)->equals($sinX));
28+
}
29+
}

0 commit comments

Comments
 (0)