Re: storing an integer in a double precision



On May 6, 6:43 am, "robin" <robi...@xxxxxxxxxxxxxxxxxx> wrote:
<tho...@xxxxxxxxxxxx> wrote in messagenews:iq0c0l$tsu$1@xxxxxxxxxxxxxxxxxxxxx
| steve <kar...@xxxxxxxxxxx> writes:

|
| > program foo
| >    integer i, j
| >    double precision, volatile :: d
| >    print *, 'Range: ', -huge(i), huge(i)
| >    do i = - huge(i), huge(i)
| >       d = i
| >       j = d
| >       if (i /=3D j) print *, i, j, d
| >    end do
| > end program foo
|
| Any chance that an optimizer might just replace d=i and j=d
| with j=i?  I'm guessing no.

No, but it might say that you're wasting computer time.  :-)
The loop may never finish.

Why
The loop may never finish.
?

Fernando.

.



Relevant Pages