Hallo, everbody. I fully agree to all of you. The definition of eps according to Matlab is fully OK; eps without an argument is the best relative accuracy (equal to the ablsolute accuracy) and eps(x) is the absolute accurcy which will degrade towards the limits of the range. But as I understand the documentation, eps returns some fixed values, depending on one assumed implementation of fp numbers. What I prefer is a calculation of eps that is affected by the actual OS and processor. Compiler switches, if needed to write portable code, are among the most error-prone things and difficult to debug ... Of course, there is also always an application-dependent tolerance. But already a comparison with eps might give an apportunity to warn the user, if the calculations are out of reasonable bounds ... before they get stuck in infinite or non-converging loops! Wish you all the best for the season, in my language simply: God Jul! Thomas Ifström -------------------------------------------------------------------------------------- Robert Bosch GmbH Automotive Electronics, Engineering Integrated Circuits, Methods, Tools & Technologies (AE/EIM3) Postfach 1342 - DE-72703 Reutlingen - GERMANY Telefon: +49 7121 35-6422 Fax: +49 711 811-514 6422 mailto:Thomas.Ifstroem@de.bosch.com http://www.bosch.de > -----Original Message----- > From: owner-vhdl-ams@eda.org [mailto:owner-vhdl-ams@eda.org] > On Behalf Of Muranyi, Arpad > Sent: Thursday, December 21, 2006 2:31 AM > To: vhdl-ams@vhdl.org > Subject: RE: Floating point related question > > John, > > Thanks for your reply and suggestions. The problem with > your suggestion is that a tolerance value is a single > number (the way I understand it) but the representation > error of floating point numbers changes depending on the > value of the number itself. For example eps(10e-15) is > much smaller than eps(10e+15), and it will also depend on > whether the number is single or double precision. > > >> eps(10e-15) > ans = 1.5777e-030 > > >> eps(10e+15) > ans = 2 > > > Arpad > ========================================================== > > -----Original Message----- > From: John Shields [mailto:John_Shields@mentor.com] > Sent: Wednesday, December 20, 2006 5:16 PM > To: Muranyi, Arpad > Cc: vhdl-ams@vhdl.org > Subject: Re: Floating point related question > > Hi Arpad, > > There is nothing in the language that I am aware of. One should only > compare real numbers using a tolerance. The tolerance to use > depends on > the application and should be defined by the user/model > writer. I think > it depends on the use case you have. You should be able to write a > user-defined function like eps, if you truly want to make comparisons > within the tolerance that eps is defined to be or compute a tolerance > based on some model of accumulated errors. There are others who may > offer specific cautions, but tolerance errors can accumulate > depending > on how expressions are computed and compilers have some freedom in > evaluation order of operands of an operator. > > Regards, > JohnReceived on Thu Dec 21 04:13:29 2006
This archive was generated by hypermail 2.1.8 : Thu Dec 21 2006 - 04:14:14 PST