Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As 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 = CInt(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")}")
   End Sub
End Module