#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // Combine all flags using integer values (or bitwise OR on enums) auto allFlags = 2 | 4 | 8 | 16; // Underflow, Overflow, DivByZero, Invalid uc.Error().FloatingPointErrorsToTrap(allFlags); cout << "All flags set: " << uc.Error().FloatingPointErrorsToTrap() << endl; // Test all conditions cout << "Underflow: " << uc.EvalStr("1e-320") << endl; cout << "Overflow: " << uc.EvalStr("1e320") << endl; cout << "DivByZero: " << uc.EvalStr("1/0") << endl; cout << "Invalid: " << uc.EvalStr("0/0") << endl; // Clear all flags uc.Error().FloatingPointErrorsToTrap(0); cout << "" << endl; cout << "All flags cleared: " << uc.Error().FloatingPointErrorsToTrap() << endl; // Verify they are cleared cout << "Underflow: " << uc.EvalStr("1e-320") << endl; cout << "Overflow: " << uc.EvalStr("1e320") << endl; cout << "DivByZero: " << uc.EvalStr("1/0") << endl; cout << "Invalid: " << uc.EvalStr("0/0") << endl; }