Question: 3. Depending on the defaults set for your compiler some care needs be taken dealing with ascii strings like 1.2; to illustrate this run

3. Depending on the defaults set for your compiler some care needs be taken dealing with ascii strings like

3. Depending on the defaults set for your compiler some care needs be taken dealing with ascii strings like 1.2; to illustrate this run this program real :: x double precision :: y, z x = 2.3/1.5 y= 2.3/1.5 z = 2.3d0/1.5d0 write (*,7) x = write (*,7) 'y = write (*,7) 'z = x y ,2 7 format (A, f11.6) end The exact value of 2.3/1.5 is 1.53333 with the digit three repeating. The A in the format statement allows for printing literal strings like 'x=' while the fl1.6 is floating point format with 11 spaces set aside with six after the decimal point. This emulates the behavior of some compilers that default to printing only six digits after the decimal place. Compare x and y, also compare y and z. Next run this program real :: x double precision y,z x 2.3/1.5 y = 2.3/1.5 z 2.3d0/1.5d0 write (7) x = write (7) y = write (,7) 2 = 7 format (A, f18.15) end This corresponds to printing out the number of digits that corresponds (on most systems) to double precision. Of course for x the digits after the seventh or eights mean nothing. Compare and y. Comment on any odd behavior. Compare y and z. Comment. If your program is supposed to be all double precision floating point is it ok to say something like 'z = 1.2345'? Is the 'd0' thing a thing on your compiler? Results are compiler dependent, so say what compiler and operating system you are using.

Step by Step Solution

3.53 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

I ran the two programs you provided using the Intel Fortran Compiler 202310223 on a Linux system Program 1 Outputx 1533330y 153333z 1533333x y Truey z ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!