[J3] Question regarding valid set of values

Malcolm Cohen malcolm at nag-j.co.jp
Fri May 21 06:17:06 UTC 2021


> The execution of any numeric operation whose result is not defined by the arithmetic used by the processor is prohibited.

 

Here, as throughout the standard, “processor” means the entire software stack along with the hardware.



> I suppose some might argument that, for example, wrap-around semantics of twos-complement integer arithmetic means the result is definable.

 

Table 10.3 says that the “+” operator is addition, by which it means normal (high school level) arithmetic addition. That is, for integers it means addition of integers, not of the group Z(2**n).

 

I agree that “some might argue”, but they are on very shaky ground if not quicksand. I also agree the standard could be a lot more rigorous here, but lack of rigor does not help most arguments, as it makes the program a priori not conforming when the standard does not establish an interpretation of it.

 

I really would prefer the standard to be a lot more specific in this area, but it is far from the top of my list of inadequacies that I’d like to see fixed. If anyone else wants to knock themselves out rigorously defining what is and isn’t allowed, and what the results of intrinsics operations are, go right ahead! I don’t think it is as easy as it looks though, and getting general agreement for a big change of wording with little or no technical effect is likely tough. As they say, “if it ain’t broke...”

 

Cheers,

-- 

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Steven G. Kargl via J3
Sent: Friday, May 21, 2021 2:53 AM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Steven G. Kargl <kargl at uw.edu>
Subject: Re: [J3] Question regarding valid set of values

 

On Thu, May 20, 2021 at 07:32:29PM +0200, Thomas König via J3 wrote:
> 
> Hi,
> 
> I have some trouble finding where the standard clearly
> forbids something.
> 
> Consider the program
> 
> integer :: i
> i = huge(i)
> write (*,*) i + 1
> end
> 

I believe you're looking for

10.1.5.2.4 Evaluation of numeric intrinsic operations

1 The execution of any numeric operation whose result is not defined by
the arithmetic used by the processor is prohibited.

This isn't a numbered constraint, so a Fortran processor is not
required to report a possible problem.

I suppose some might argument that, for example, wrap-around
semantics of twos-complement integer arithmetic means the
result is definable. 

-- 
Steve



Disclaimer

The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: 30 St. Giles, Oxford, OX1 3LE, United Kingdom. Please see our Privacy Notice <https://www.nag.co.uk/content/privacy-notice>  for information on how we process personal data and for details of how to stop or limit communications from us.

This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210521/759b54d8/attachment.htm>


More information about the J3 mailing list