Why and when do I need to call _fpreset ()?

The only documentation I can find (on MSDN or otherwise) is that calling _fpreset() "drops the floating point packet." What is a floating point packet? Does this also mean the status word FPU? I see documentation that says to call _fpreset() when recovering from SIGFPE, but does not execute _clearfp() this too? Do I need to call both?

I am working on an application that mask some FP exceptions (using _controlfp() ). When I want to reset the FPU to its default state (say when calling .NET code), I should just call _clearfp() , _fpreset() or both. This is critical performance code, so I don't want to call both if I don't need to ...

+4
source share
1 answer

_fpreset() resets the state of a floating point block. It resets the default FPU accuracy and clears the FPU status word. The two cases that I see for this are recovering from FPE (as you said) and getting control from library code (like a DLL in which you don't control) that screwed up the FPU in some way, like precision.

+3
source

Source: https://habr.com/ru/post/1300783/


All Articles