mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00

Fixed recognition of the operator Added opcode, still doing multiply instead of pow() opcode now always returns int(42) The right answer, but always a float Yanked code from pow() implementation. Should not handle negative long as exponent ourselves Added test cases from pow() Moved precedence higher than '~' Added GMP operator overloading Added ZEND_ASSIGN_POW (**=) operator. Added pow() as a language construct. Adjusted test cases for changed precedence. Reduced pow() to shell function around ZEND_API pow_function() Reduced test case to only contain edge cases Added overloading test case Moved unary minus above T_POW Revert "Added pow() as a language construct." Bad bad bad idea. This reverts commit f60b98cf7a8371233d800a6faa286ddba4432d02. Reverted unary minus behaviour due to previous revert. Convert arrays to int(0) Exponent with array as a base becomes int(0) Rebase against master Fixed tokenizer test case
22 lines
389 B
PHP
22 lines
389 B
PHP
--TEST--
|
|
Various pow() tests
|
|
--FILE--
|
|
<?php // $Id$
|
|
|
|
$x = 2;
|
|
$x **= 3;
|
|
|
|
$tests = <<<TESTS
|
|
-3 ** 2 === -9
|
|
(-3) **2 === 9
|
|
2 ** 3 ** 2 === 512
|
|
(2 ** 3) ** 2 === 64
|
|
$x === 8
|
|
TESTS;
|
|
|
|
echo "On failure, please mail result to php-dev@lists.php.net\n";
|
|
include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
|
|
|
|
--EXPECT--
|
|
On failure, please mail result to php-dev@lists.php.net
|
|
OK
|