Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
Arithmetic: Add more constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Jan 20, 2017
2 parents b88b213 + 92a7644 commit 311a733
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
26 changes: 18 additions & 8 deletions Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,24 @@ protected function initializeConstants()

if (null === $_constants) {
$_constants = new \ArrayObject([
'PI' => M_PI,
'PI_2' => M_PI_2,
'PI_4' => M_PI_4,
'E' => M_E,
'SQRT_PI' => M_SQRTPI,
'SQRT_2' => M_SQRT2,
'SQRT_3' => M_SQRT3,
'LN_PI' => M_LNPI
'PI' => M_PI,
'PI_2' => M_PI_2,
'PI_4' => M_PI_4,
'E' => M_E,
'SQRT_PI' => M_SQRTPI,
'SQRT_2' => M_SQRT2,
'SQRT_3' => M_SQRT3,
'LN_PI' => M_LNPI,
'LOG_2E' => M_LOG2E,
'LOG_10E' => M_LOG10E,
'LN_2' => M_LN2,
'LN_10' => M_LN10,
'ONE_OVER_PI' => M_1_PI,
'TWO_OVER_PI' => M_2_PI,
'TWO_OVER_SQRT_PI' => M_2_SQRTPI,
'ONE_OVER_SQRT_2' => M_SQRT1_2,
'EULER' => M_EULER,
'INFINITE' => INF
]);
}

Expand Down
26 changes: 18 additions & 8 deletions Test/Unit/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,24 @@ public function case_context_has_predefined_constants()
->isInstanceOf('ArrayObject')
->array(iterator_to_array($result))
->isEqualTo([
'PI' => M_PI,
'PI_2' => M_PI_2,
'PI_4' => M_PI_4,
'E' => M_E,
'SQRT_PI' => M_SQRTPI,
'SQRT_2' => M_SQRT2,
'SQRT_3' => M_SQRT3,
'LN_PI' => M_LNPI
'PI' => M_PI,
'PI_2' => M_PI_2,
'PI_4' => M_PI_4,
'E' => M_E,
'SQRT_PI' => M_SQRTPI,
'SQRT_2' => M_SQRT2,
'SQRT_3' => M_SQRT3,
'LN_PI' => M_LNPI,
'LOG_2E' => M_LOG2E,
'LOG_10E' => M_LOG10E,
'LN_2' => M_LN2,
'LN_10' => M_LN10,
'ONE_OVER_PI' => M_1_PI,
'TWO_OVER_PI' => M_2_PI,
'TWO_OVER_SQRT_PI' => M_2_SQRTPI,
'ONE_OVER_SQRT_2' => M_SQRT1_2,
'EULER' => M_EULER,
'INFINITE' => INF
]);
}

Expand Down

0 comments on commit 311a733

Please sign in to comment.