This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with double precision in g77


ew fgff wrote:
         if(a .eq. p)then
           print*,a
         endif

Exact comparison of FP values often doesn't work because of rounding errors.


None of the values 0.1, 0.2, or 0.3 can be exactly represented in the binary FP double format. They are all rounded approximations. When you add 0.1 to 0.2, you get another rounded approximation, which is different than the other rounded approximation you got for 0.3.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]