Standard_Overflow Exception

Diagnostic signature

Standard_Overflow

Standard_Overflow is an Open CASCADE Technology (OCCT) diagnostic exception emitted when a numeric operation computes a value exceeding the bounds of the underlying data type, such as DBL_MAX for a floating-point type [1].

What it means

Standard_Overflow is an exception class defined within the Open CASCADE Technology (OCCT) framework [1]. Inheriting from Standard_NumericError, it denotes that a programmatic arithmetic operation has yielded a result larger than the maximum permissible bounds of its target data type, typically standard double-precision floating-point bounds (Standard_Real). When this exception is invoked, the application execution flow transfers to the nearest enclosing matching catch block on the call stack, halting further geometry processing along the aborted mathematical operation path [2].

Why it happens

The underlying Open CASCADE mathematical and geometric calculation toolkits emit this error when algorithm state variables, such as parametric variables evaluating 3D curves or scaling matrices, encounter inputs leading to unbounded mathematical divergence [1]. The library checks internal limits using the Standard_Overflow_Raise_if macro and throws the exception prior to producing a silent invalid state, such as an infinity or NaN [1]. Alternatively, if hardware floating-point exceptions (FPE) are configured system-wide using OSD::SetSignal(), the OCCT macro OCC_CATCH_SIGNALS maps the operating system's native overflow signals (e.g., SIGFPE) directly to this Standard_Overflow C++ exception [2].

Minimal reproduction

#include <iostream>
#include <Standard_Overflow.hxx>

double compute_exponential_scale(double input_scale) {
    // Upstream geometric and math packages assert strict numerical limits.
    // If input scale is too extreme, OCCT explicitly raises standard overflow.
    Standard_Overflow_Raise_if(input_scale > 1e150, "Scale exceeds maximum representable bounds");
    
    return input_scale * 2.0;
}

int main() {
    try {
        compute_exponential_scale(1e200);
    }
    catch (const Standard_Overflow& e) {
        std::cerr << "Diagnostic Caught: " << e.DynamicType()->Name() << " - " << e.GetMessageString() << std::endl;
        return 1;
    }
    return 0;
}

How to fix it

Clamp parameter variables to mathematically safe limits prior to invoking OCCT algorithms, and encapsulate volatile evaluations in try-catch scopes to explicitly handle standard numeric exceptions.

```C++
#include <iostream>
#include <Standard_Overflow.hxx>

double compute_exponential_scale(double input_scale) {
    // 1. Clamp extremely large inputs to mathematically safe bounds
    // before OCCT numeric evaluations.
    double safe_scale = input_scale;
    const double MAX_SAFE_SCALE = 1e150;
    
    if (safe_scale > MAX_SAFE_SCALE) {
        safe_scale = MAX_SAFE_SCALE;
        std::cerr << "Warning: Capping scale to safe bounds." << std::endl;
    }
    
    Standard_Overflow_Raise_if(safe_scale > MAX_SAFE_SCALE, "Scale exceeds maximum representable bounds");
    return safe_scale * 2.0;
}

int main() {
    try {
        // 2. Wrap geometric evaluations in try-catch blocks to safely intercept standard exceptions
        compute_exponential_scale(1e200);
    }
    catch (const Standard_Overflow& e) {
        std::cerr << "Diagnostic Caught: " << e.DynamicType()->Name() << std::endl;
        return 1;
    }
    
    std::cout << "Computation successfully mitigated overflow risks." << std::endl;
    return 0;
}
```

Step 1

Step 2

Step 3

Step 4

Upstream references

Open CASCADE Technology OCCT 7.8.0 — Standard_Overflow.hxx — retrieved 2026-08-11

Foundation Classes Documentation - Exception Handling