using uCalcSoftware; var uc = new uCalc(); // Get the initial state (default is 0, no errors raised) Console.WriteLine($"Initial flags: {uc.Error.FloatingPointErrorsToTrap}"); // Enable raising an error for division by zero uc.Error.FloatingPointErrorsToTrap = (int)ErrorCode.FloatDivisionByZero; // Verify the new state Console.WriteLine($"Updated flags: {uc.Error.FloatingPointErrorsToTrap}"); // Test the behavior Console.WriteLine($"1/0 = {uc.EvalStr("1/0")}"); // Disable the flag by setting it back to 0 uc.Error.FloatingPointErrorsToTrap = 0; Console.WriteLine($"Flags after reset: {uc.Error.FloatingPointErrorsToTrap}"); Console.WriteLine($"1/0 after reset = {uc.EvalStr("1/0")}");