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

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   cout << "--- Default Behavior (No Errors Raised) ---" << endl;
   cout << "1/0: " << uc.EvalStr("1/0") << endl;
   cout << "0/0: " << uc.EvalStr("0/0") << endl;
   cout << "Overflow (5*10^308): " << uc.EvalStr("5*10^308") << endl;
   cout << "Underflow (10^-308/10000): " << uc.EvalStr("10^-308/10000") << endl;

   cout << "" << endl;
   cout << "--- Enable Invalid Operation & Underflow ---" << endl;
   // You can pass multiple enum members to enable them simultaneously
   uc.Error().SetFloatingPointErrorsToTrap(ErrorCode::FloatInvalid, ErrorCode::FloatUnderflow);
   cout << "Current flags: " << uc.Error().FloatingPointErrorsToTrap() << endl; // Should be 16 (Invalid) + 2 (Underflow) = 18

   cout << "1/0: " << uc.EvalStr("1/0") << endl; // Not enabled, returns inf
   cout << "0/0: " << uc.EvalStr("0/0") << endl; // Enabled, raises error
   cout << "Overflow (5*10^308): " << uc.EvalStr("5*10^308") << endl; // Not enabled, returns inf
   cout << "Underflow (10^-308/10000): " << uc.EvalStr("10^-308/10000") << endl; // Enabled, raises error
}