[php-src] Issue #11270: Unexpected behavior in division by zero in algebraic expressions
| From: | andmarruda | Date: | Thu, 18 May 2023 20:04:45 +0000 |
| Subject: | [php-src] Issue #11270: Unexpected behavior in division by zero in algebraic expressions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244481@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11270
Author: andmarruda
### Description
The following code:
```php
<?php
function limit(float $x) : float
{
return pow($x,2) - 4 / pow($x,2) - $x - 2;
}
var_dump(limit(2));
```
Resulted in this output:
```
float(-1);
```
But I expected this output instead:
```
Division by zero error
```
I have used PHP 8.2.5.

Is this an unexpected behavior or has some explanation?
Thanks to everyone!
### PHP Version
PHP 8.2.5
### Operating System
Debian GNU/Linux 10 (buster)