TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Mime-Version: 1.0
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
From: "Pickett, Michael" <[log in to unmask]>
Date: Thu, 13 Feb 1997 10:18:00 +0000
Content-Type: TEXT/PLAIN
Reply-To: "Pickett, Michael" <[log in to unmask]>
Parts/Attachments: TEXT/PLAIN (21 lines)
Hello Ray,

Floating point is tricky stuff. I don't think you should be surprised that
adding five floating point numbers together in different orders gives very
slightly different results. It might be wise to suspect that your printed
results are not telling you the full story. For example, it is possible that
the conversion from binary to decimal is giving the same decimal result for
different binary numbers, perhaps due to limitiations in the conversion
routine. I suggest you take a look at the binary representations of your path
lengths. You may find that it makes sense to put in a small tolerance on the
comparison, rather than test for exact equality.

I note that you had to tweak your Common Lisp program because of
discrepancies in the 15th digit. In your Ada program, you have specified your
floating point type as only 8 digits. I don't know what representation GNAT
uses for this type, but if you are only interested in 8 digits, you ought to
set the tolerance in your comparison to reflect this.

--Michael Pickett--
(responding personally, and not on behalf of BAeSEMA)