Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Q re integer multiply

$
0
0

I noticed that when I multiply two integer(4) quantities together,

the compiler does not allow the result to be integer(8).

So is there a way to FORCE the correct answer?

For example:

integer(4) x,y

integer(8) z

Z=x*y does not give correct results in MOST cases, unless x and y are small.

What can I do to MAKE SURE I will get the correct answer?

Notice that if x and y are each 31 bits, Z can be 62 bits, which will fit into a INTEGER(8) result.

Is there a way to force the compiler to look for an integer overflow?


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>