Internal Test: Verifies that setting and clearing all possible floating-point flags works correctly.

ID: 350

				
					using uCalcSoftware;

var uc = new uCalc();
// Combine all flags using integer values (or bitwise OR on enums)
var allFlags = 2 | 4 | 8 | 16; // Underflow, Overflow, DivByZero, Invalid
uc.Error.FloatingPointErrorsToTrap = allFlags;
Console.WriteLine($"All flags set: {uc.Error.FloatingPointErrorsToTrap}");

// Test all conditions
Console.WriteLine($"Underflow: {uc.EvalStr("1e-320")}");
Console.WriteLine($"Overflow: {uc.EvalStr("1e320")}");
Console.WriteLine($"DivByZero: {uc.EvalStr("1/0")}");
Console.WriteLine($"Invalid: {uc.EvalStr("0/0")}");

// Clear all flags
uc.Error.FloatingPointErrorsToTrap = 0;
Console.WriteLine("");
Console.WriteLine($"All flags cleared: {uc.Error.FloatingPointErrorsToTrap}");

// Verify they are cleared
Console.WriteLine($"Underflow: {uc.EvalStr("1e-320")}");
Console.WriteLine($"Overflow: {uc.EvalStr("1e320")}");
Console.WriteLine($"DivByZero: {uc.EvalStr("1/0")}");
Console.WriteLine($"Invalid: {uc.EvalStr("0/0")}");
				
			
All flags set: 30
Underflow: Floating point underflow
Overflow: Floating point overflow
DivByZero: Division by 0
Invalid: Invalid operation

All flags cleared: 0
Underflow: 0
Overflow: inf
DivByZero: inf
Invalid: nan
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Combine all flags using integer values (or bitwise OR on enums)
   auto allFlags = 2 | 4 | 8 | 16; // Underflow, Overflow, DivByZero, Invalid
   uc.Error().FloatingPointErrorsToTrap(allFlags);
   cout << "All flags set: " << uc.Error().FloatingPointErrorsToTrap() << endl;

   // Test all conditions
   cout << "Underflow: " << uc.EvalStr("1e-320") << endl;
   cout << "Overflow: " << uc.EvalStr("1e320") << endl;
   cout << "DivByZero: " << uc.EvalStr("1/0") << endl;
   cout << "Invalid: " << uc.EvalStr("0/0") << endl;

   // Clear all flags
   uc.Error().FloatingPointErrorsToTrap(0);
   cout << "" << endl;
   cout << "All flags cleared: " << uc.Error().FloatingPointErrorsToTrap() << endl;

   // Verify they are cleared
   cout << "Underflow: " << uc.EvalStr("1e-320") << endl;
   cout << "Overflow: " << uc.EvalStr("1e320") << endl;
   cout << "DivByZero: " << uc.EvalStr("1/0") << endl;
   cout << "Invalid: " << uc.EvalStr("0/0") << endl;
}
				
			
All flags set: 30
Underflow: Floating point underflow
Overflow: Floating point overflow
DivByZero: Division by 0
Invalid: Invalid operation

All flags cleared: 0
Underflow: 0
Overflow: inf
DivByZero: inf
Invalid: nan
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Combine all flags using integer values (or bitwise OR on enums)
      Dim allFlags = 2 Or 4 Or 8 Or 16 '// Underflow, Overflow, DivByZero, Invalid
      uc.Error.FloatingPointErrorsToTrap = allFlags
      Console.WriteLine($"All flags set: {uc.Error.FloatingPointErrorsToTrap}")
      
      '// Test all conditions
      Console.WriteLine($"Underflow: {uc.EvalStr("1e-320")}")
      Console.WriteLine($"Overflow: {uc.EvalStr("1e320")}")
      Console.WriteLine($"DivByZero: {uc.EvalStr("1/0")}")
      Console.WriteLine($"Invalid: {uc.EvalStr("0/0")}")
      
      '// Clear all flags
      uc.Error.FloatingPointErrorsToTrap = 0
      Console.WriteLine("")
      Console.WriteLine($"All flags cleared: {uc.Error.FloatingPointErrorsToTrap}")
      
      '// Verify they are cleared
      Console.WriteLine($"Underflow: {uc.EvalStr("1e-320")}")
      Console.WriteLine($"Overflow: {uc.EvalStr("1e320")}")
      Console.WriteLine($"DivByZero: {uc.EvalStr("1/0")}")
      Console.WriteLine($"Invalid: {uc.EvalStr("0/0")}")
   End Sub
End Module
				
			
All flags set: 30
Underflow: Floating point underflow
Overflow: Floating point overflow
DivByZero: Division by 0
Invalid: Invalid operation

All flags cleared: 0
Underflow: 0
Overflow: inf
DivByZero: inf
Invalid: nan