Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!mips!pacbell.com!ucsd!nosc!humu!pegasus!tleylan From: tleylan@pegasus.com (Tom Leylan) Newsgroups: comp.databases Subject: Re: Clipper round() problem Message-ID: <1991Jun28.221027.7939@pegasus.com> Date: 28 Jun 91 22:10:27 GMT References: <1991Jun27.095337.11969@vaxa.strath.ac.uk> Organization: Pegasus, Honolulu Lines: 22 In article <1991Jun27.095337.11969@vaxa.strath.ac.uk> cnas09@vaxa.strath.ac.uk writes: > > Can anyone explain the (to me) rather peculiar behaviour of the round() >routine in Clipper 5? If you do something like round(37*1.175, 2) then round() >correctly reports 43.48 but using round(39*1.175, 2) gives 45.82 when it should >have rounded it up to 45.83! > Aaron, I can't give you _the_ reason but I believe that it is somewhat due to the behavior of the MSC alternate floating point library that Clipper uses. It would seem that the binary representation of 39 * 1.175 isn't 45.825 but is more like 45.8249999999 while the output is 45.825. I think it's annoying but I don't believe that you'll find that the ROUND() function is "wrong" but rather that the number it is being asked to round isn't the one that we see. I'll see if I can track down a more exact answer. tom