[J3] [SC22WG5.6475] [EXTERNAL] [BULK] raising a negative real value to a real power is prohibited

Jeff Hammond jehammond at nvidia.com
Wed Aug 23 13:26:56 UTC 2023


I assume your example is already covered by the first sentence.

Bob’s response helped me understand the extra constraint.

Thanks,

Jeff

From: Clune, Thomas L. (GSFC-6101) <thomas.l.clune at nasa.gov>
Date: Wednesday, 23. August 2023 at 16.11
To: General J3 interest list <j3 at mailman.j3-fortran.org>, WG5 <sc22wg5 at open-std.org>
Cc: Jeff Hammond <jehammond at nvidia.com>
Subject: Re: [EXTERNAL] [BULK] [J3] [SC22WG5.6473] raising a negative real value to a real power is prohibited
External email: Use caution opening links or attachments

What would you expect for the output of this modified program?

program main
  implicit none
  real :: x, y
  x = -2.0
  y =  0.5
  print*,x**y
end program main

I.e., are you wanting the compiler to detect that a given float is close enough to an integer that the result is real rather than complex?   Or are you expecting the compiler to convert all such expressions to complex when x is negative?


From: J3 <j3-bounces at mailman.j3-fortran.org> on behalf of j3 <j3 at mailman.j3-fortran.org>
Reply-To: j3 <j3 at mailman.j3-fortran.org>
Date: Wednesday, August 23, 2023 at 8:22 AM
To: WG5 <sc22wg5 at open-std.org>
Cc: Jeff Hammond <jehammond at nvidia.com>
Subject: [EXTERNAL] [BULK] [J3] [SC22WG5.6473] raising a negative real value to a real power is prohibited

CAUTION: This email originated from outside of NASA.  Please take care when clicking links or opening attachments.  Use the "Report Message" button to report suspicious messages to the NASA SOC.



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/407cdba6/attachment-0001.htm>


More information about the J3 mailing list