Re: [PHP-DEV] [RFC][Discussion] Raising zero to the power of negative number

2024-03-17 Thread Jorg Sowa
Thank you Marc for your opinion. It makes sense to me that we should have
the possibility to mimic the IEEE-754 standard, thus we should have `fpow`
function as well. I have updated the RFC and would like to start the voting
if there are no new comments.

Kind regards,
Jorg Sowa


Re: [PHP-DEV] [RFC][Discussion] Raising zero to the power of negative number

2024-02-25 Thread Marc Bennewitz

Hi Jorg,

On 13.01.24 00:25, Jorg Sowa wrote:

Thank you for the suggestions. I agree that error message should be more
meaningful. I changed it.

The main driver of this change is to match the division by zero behavior
for both operators which can operate on both integers and floats. Would it
make sense to create a function `fpow` similarly to `fdiv` for the correct
IEEE 754 logic?


As of your note of consistent behavior here, in your RFC I don't see any 
note about operating on float - It's all about int. It would be good to 
explicitly describe both int and float behavior in your RFC.


About `fpow` - I personally never felled the need to use `fdiv` but as 
`fdiv` was explicitly introduced to expose IEEE-754 semantics I think it 
totally makes sense to add `fpow` as well.


Greetings,
Marc


Kind regards,
Jorg



OpenPGP_0x3936ABF753BC88CE.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: [PHP-DEV] [RFC][Discussion] Raising zero to the power of negative number

2024-02-08 Thread Jorg Sowa
Hello everyone,
If there is no other feedback I would like to start voting in the next few
days.

Kind regards,
Jorg


Re: [PHP-DEV] [RFC][Discussion] Raising zero to the power of negative number

2024-01-12 Thread Jorg Sowa
Thank you for the suggestions. I agree that error message should be more
meaningful. I changed it.

The main driver of this change is to match the division by zero behavior
for both operators which can operate on both integers and floats. Would it
make sense to create a function `fpow` similarly to `fdiv` for the correct
IEEE 754 logic?

Kind regards,
Jorg


Re: [PHP-DEV] [RFC][Discussion] Raising zero to the power of negative number

2024-01-11 Thread Gina P. Banyard


On Thursday, 11 January 2024 at 21:47, tag Knife  wrote:
> On Thu, 11 Jan 2024 at 21:29, Jorg Sowa jorg.s...@gmail.com wrote:
> 
> > Hello everyone!
> > 
> > I want to start the discussion on the RFC: Raising zero to the power of
> > negative number
> > 
> > Link: https://wiki.php.net/rfc/raising_zero_to_power_of_negative_number
> > 
> > Kind regards,
> > Jorg
> 
> 
> IEEE 754 dictates that an infinity should be the expected output for all
> these scenarios.

IEEE 754 only deals with floating point numbers, and even then if you want IEEE 
754 behaviour for division you need to use fdiv() as of PHP 8.0 as any division 
by 0 throws this error since 
https://wiki.php.net/rfc/engine_warnings#division_by_zero got accepted.

I think this change makes sense but would rather have an improved wording/Error 
as proposed by Ben.

Best regards,

Gina P. Banyard

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



Re: [PHP-DEV] [RFC][Discussion] Raising zero to the power of negative number

2024-01-11 Thread Ben Ramsey

On 1/11/24 15:47, tag Knife wrote:

On Thu, 11 Jan 2024 at 21:29, Jorg Sowa  wrote:


Hello everyone!

I want to start the discussion on the RFC: Raising zero to the power of
negative number

Link: https://wiki.php.net/rfc/raising_zero_to_power_of_negative_number

Kind regards,
Jorg



  IEEE 754 dictates that an infinity should be the expected output for all
these scenarios.



If I'm reading the text of IEEE 754-2019 correctly, it means that the 
division by zero error should occur when an operation on finite operands 
gives an exact infinite result.


"The divideByZero exception shall be signaled if and only if an exact 
infinite result is defined for an operation on finite operands."


Cheers,
Ben



OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: [PHP-DEV] [RFC][Discussion] Raising zero to the power of negative number

2024-01-11 Thread tag Knife
On Thu, 11 Jan 2024 at 21:29, Jorg Sowa  wrote:

> Hello everyone!
>
> I want to start the discussion on the RFC: Raising zero to the power of
> negative number
>
> Link: https://wiki.php.net/rfc/raising_zero_to_power_of_negative_number
>
> Kind regards,
> Jorg
>

 IEEE 754 dictates that an infinity should be the expected output for all
these scenarios.


[PHP-DEV] [RFC][Discussion] Raising zero to the power of negative number

2024-01-11 Thread Jorg Sowa
Hello everyone!

I want to start the discussion on the RFC: Raising zero to the power of
negative number

Link: https://wiki.php.net/rfc/raising_zero_to_power_of_negative_number

Kind regards,
Jorg