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, John Muranyi, Arpad wrote: > Hello Everyone, > > We all know that using relational operators between > floating point numbers is a risky proposition. This > code, for example, may never execute, believe it or > not, (I tried it): > > if (0.1+0.2 = 0.3) then > report "Test"; > end if; > > However, there are times when taking care of such > floating point errors may be needed. > > In Matlab there is a function, called "eps" which > can help in incorporating such errors in equations. > http://www.mathworks.com/access/helpdesk/help/techdoc/ref/index.html?/ac > cess/helpdesk/help/techdoc/ref/eps.html&http://www.google.com/search?hl= > en&q=eps+function > > I would like to find out whether there is a similar > function in VHDL-AMS. For a moment I thought I could > use the T'succ(x) or related functions, but the problem > is that this would only work on discrete or physical > types. The type "real" is not one of these. Could > someone give me some ideas how to go about this? > > Thanks, and Happy Holidays... > > Arpad > ======================================================== > >Received on Wed Dec 20 17:46:51 2006
This archive was generated by hypermail 2.1.8 : Wed Dec 20 2006 - 17:47:07 PST