Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Console.WriteLine("--- Default Behavior (No Errors Raised) ---")
      Console.WriteLine($"1/0: {uc.EvalStr("1/0")}")
      Console.WriteLine($"0/0: {uc.EvalStr("0/0")}")
      Console.WriteLine($"Overflow (5*10^308): {uc.EvalStr("5*10^308")}")
      Console.WriteLine($"Underflow (10^-308/10000): {uc.EvalStr("10^-308/10000")}")
      
      Console.WriteLine("")
      Console.WriteLine("--- Enable Invalid Operation & Underflow ---")
      '// You can pass multiple enum members to enable them simultaneously
      uc.Error.SetFloatingPointErrorsToTrap(ErrorCode.FloatInvalid, ErrorCode.FloatUnderflow)
      Console.WriteLine($"Current flags: {uc.Error.FloatingPointErrorsToTrap}") '// Should be 16 (Invalid) + 2 (Underflow) = 18
      
      Console.WriteLine($"1/0: {uc.EvalStr("1/0")}") '// Not enabled, returns inf
      Console.WriteLine($"0/0: {uc.EvalStr("0/0")}") '// Enabled, raises error
      Console.WriteLine($"Overflow (5*10^308): {uc.EvalStr("5*10^308")}") '// Not enabled, returns inf
      Console.WriteLine($"Underflow (10^-308/10000): {uc.EvalStr("10^-308/10000")}") '// Enabled, raises error
   End Sub
End Module