Re: C++Builder and Delphi Exceptions
mihai oltean <[email protected]>
| Newsgroups | gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <[email protected]> |
Dear Rory, > First, an overflow of the Double type may not result > in an EOverflow > exception. If the FPU/NPU has encountered an > underflow or denormal since it > was last reset, Delphi gives an EInvalidOp instead > of EOverflow. (I don't > know what BCB does.) I suggest you test for > EMathError instead, since this > catches all overflow exceptions. I also catch EInvalidOp, but I'm not able to catch NAN or INF. It seems that NAN is generated by the sin or cos functions which theoretically take a double as a parameter but if the value is larger than 1E20 they (sin and cos) return a NAN. > You should determine just how those NANs and INFs > are getting into your > data. They do not easily result from normal > operations. I believe that the > most common ways they result are from the FPU > control word changed to ignore > overflow and other errors, constants (which means > *you* put them in your > program), or from floating fields in a database. > You could probably save > time by checking these special values only at input > (and ensuring the FPU > control word is not changed). I can't only check at the begining because they are dynamically generated during the execution. > How complicated is your test for INF/NAN? If you > don't need to distinguish > between them, there is a simple test for "special" > values for a double > variable: > > if (Int64(DblVariable) and $7FF00000) = $7FF00000 > then ... The problem is that the programs call > 1.000.000 of such functions. So I really have to avoid them. Thank you Mihai > > HTH. > > Rory Daulton > [email protected] > Campus Crusade for Christ > > > --- > [This E-mail scanned for viruses by Declude Virus > and Nmax "Your MAXimum Connection!"] > [This E-mail scanned for spam by Declude JunkMail > and Nmax "Your MAXimum Connection!"] > > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ------------------------ Yahoo! Groups Sponsor ---------------------~--> Free shipping on all inkjet cartridge & refill kit orders to US & Canada. Low prices up to 80% off. We have your brand: HP, Epson, Lexmark & more. http://www.c1tracking.com/l.asp?cid=5510 http://us.click.yahoo.com/GHXcIA/n.WGAA/ySSFAA/i7folB/TM ---------------------------------------------------------------------~-> CodeCoffer - new Delphi code protection Tool! http://www.delphicollection.com/public/CodeCoffer.htm --------------------------------------------------------------- Unsubscribe:[email protected] List owner:[email protected] --------------------------------------------------------------- Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/