[J3] [SC22WG5.6473] raising a negative real value to a real power is prohibited

Robert Corbett rpcorbett at att.net
Wed Aug 23 12:58:35 UTC 2023


The restriction allows exponentiation to be implemented using

      exp(y*log(x))

Computing the log of a negative number adds complexity to the implementation.

Bob Corbett

> On Aug 23, 2023, at 5:22 AM, Jeff Hammond via J3 <j3 at mailman.j3-fortran.org> wrote:
> 
> 
> Do I understand the following text correctly, that is, that the following program is prohibited, even though it perfectly well-defined mathematically?
> “10.1.5.2.4 Evaluation of numeric intrinsic operations
> 
> The execution of any numeric operation whose result is not defined by the arithmetic used by the processor is prohibited. Raising a negative real value to a real power is prohibited.”
> 
> program main
>   implicit none
>   real :: x, y
>   x = -2.0
>   y =  2.0
>   print*,x**y
> end program main
>  
> The first sentence is completely reasonable and seems sufficient to cover the problematic cases.  I do not understand why the second sentence is necessary.
>  
> Thanks,
>  
> Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20230823/8fd06bbe/attachment.htm>


More information about the J3 mailing list