#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Get the initial state (default is 0, no errors raised)
   cout << "Initial flags: " << uc.Error().FloatingPointErrorsToTrap() << endl;

   // Enable raising an error for division by zero
   uc.Error().FloatingPointErrorsToTrap((int)ErrorCode::FloatDivisionByZero);

   // Verify the new state
   cout << "Updated flags: " << uc.Error().FloatingPointErrorsToTrap() << endl;

   // Test the behavior
   cout << "1/0 = " << uc.EvalStr("1/0") << endl;

   // Disable the flag by setting it back to 0
   uc.Error().FloatingPointErrorsToTrap(0);
   cout << "Flags after reset: " << uc.Error().FloatingPointErrorsToTrap() << endl;
   cout << "1/0 after reset = " << uc.EvalStr("1/0") << endl;
}