Isolating the environment locally
The class TFPEnvironmentScope supports functions which run in an isolated scope. Its constructor saves the current state and optionally installs a new one. Its destructor unconditionally restores the saved prior state.
#pragma fenv_access on
double IsolatedFunction(double x) {
TFPEnvironmentScope localEnvironment(kFPToNearest);
// compute result, rounding to nearest
return result; // return value without setting flags
}
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.
Generated with WebMaker