- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My code deals with numbers whose value can be almost anything. If a very small number gets raised to the 18th power, it triggers an underflow error. I have the Properties Page set so underflow gives 0.0 (in Visual Studio), and that seems to work -- but I can sometimes get this:
First-chance exception at 0x013b23bd in SYNOPSYS200v15.exe: 0xC0000090: Floating-point invalid operation.
Unhandled exception at 0x013b23bd in SYNOPSYS200v15.exe: 0xC000041D: An unhandled exception was encountered during a user callback.
First-chance exception at 0x013b23bd in SYNOPSYS200v15.exe: 0xC0000090: Floating-point invalid operation.
Unhandled exception at 0x013b23bd in SYNOPSYS200v15.exe: 0xC000041D: An unhandled exception was encountered during a user callback.
First-chance exception at 0x013b23bd in SYNOPSYS200v15.exe: 0xC0000090: Floating-point invalid operation.
Unhandled exception at 0x013b23bd in SYNOPSYS200v15.exe: 0xC000041D: An unhandled exception was encountered during a user callback.
First-chance exception at 0x013b23bd in SYNOPSYS200v15.exe: 0xC0000090: Floating-point invalid operation.
Unhandled exception at 0x013b23bd in SYNOPSYS200v15.exe: 0xC000041D: An unhandled exception was encountered during a user callback.
The program '[7568] SYNOPSYS200v15.exe: Native' has exited with code 0 (0x0).
Then the program crashes. What should I do?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Setting FTZ (flush to zero) using a VS property (or by specifying /Qftz- as a compiler option) may not protect you from unwanted floating point behavior in library functions.
Have you located the point where the exception occurs? If it occurs in a library that you cannot recompile with the proper FPU control flags set, you may have to do one of
- Check a function argument before calling a library function. For example, instead of "y = x ** 18", you can say "if ( abs(x) < 1d-17) then y = 0 else y = x ** 18".
- Capture and process the underflow exception.
- Use the facilities provided in the IEEE_EXCEPTIONS, IEEE_ARITHMETIC, and IEEE_FEATURES modules.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An alternate and easier solution is to
USE INTRINSIC :: IEEE_EXCEPTIONS Call IEEE_SET_HALTING_MODE(IEEE_UNDERFLOW, .FALSE.)
that will take care of your problem.
Brooks
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page