Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

values

vader1000
Beginner
822 Views
what does fortran do with literals in a calculation? ie, if all the variables in this equation are real(4), what will this result in?

a = b * c / 2

will it do integer divide, or will it cast 2 as a real*4? similar, what if you do this:

a = b * c / 2.

i assume this always forces "2." to be a real*4... please verify, this is something i have never been 100% confident of, and i'd like to know for sure.

0 Kudos
1 Reply
Intel_C_Intel
Employee
822 Views
See the topic "Data Type of Numeric Expressions"
in the help.

In the given case, the integer 2 will be promoted
to a real*4.
0 Kudos
Reply