PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Math » Math_RPN » Bug #2230

'difference' doesn't work after a 'right bracket'

Details

Submitted2004-08-26 23:04 UTC
Fromfrank at tuxrocks dot com
Assignedmszczytowski
StatusClosed
PackageMath_RPN
PHP Version4.3.8
OSLinux
Roadmaps(Not assigned)

Comments

[2004-08-26 23:04 UTC] frank at tuxrocks dot com

Description:
------------
When a 'difference' operator is used immediately after a 'right bracket', it throws an error. A 'sum' works, though.

Reproduce code:
---------------
$expression = "(2^3)-3";
# $expression = "(2^3)+-3"; --- this works, though
$rpn = new Math_Rpn();
$Result = $rpn->calculate($expression,'deg',false);
print_r($Result);

Expected result:
----------------
5

Actual result:
--------------
pear_error Object
(
[error_message_prefix] =>
[mode] => 1
[level] => 1024
[code] =>
[message] => Syntax error
[userinfo] =>
[backtrace] => Array
(
[0] => Array
(
[file] => /usr/share/pear/PEAR.php
[line] => 539
[function] => pear_error
[class] => pear_error
[type] => ->
[args] => Array
(
[0] => Syntax error
[1] =>
[2] => 1
[3] => 1024
[4] =>
)

)

[1] => Array
(
[file] => /usr/share/pear/Math/RPN.php
[line] => 135
[function] => raiseerror
[class] => pear
[type] => ::
[args] => Array
(
[0] => Syntax error
)

)

[2] => Array
(
[file] => /usr/share/pear/Math/RPN.php
[line] => 932
[function] => _raiseerror
[class] => math_rpn
[type] => ->
[args] => Array
(
[0] => Syntax error
)

)

[3] => Array
(
[file] => /usr/share/pear/Math/RPN.php
[line] => 239
[function] => _rpntovalue
[class] => math_rpn
[type] => ->
[args] => Array
(
)

)

[4] => Array
(
[file] => /tmp/test_rpn.php
[line] => 13
[function] => calculate
[class] => math_rpn
[type] => ->
[args] => Array
(
[0] => (2^3)-3
[1] => deg
[2] =>
)

)

)

[callback] =>
)