Skip to content

Dead code in ErrorModel::horizontal_latency vessel speed check #16

@rolker

Description

@rolker

Description

In error_model.cpp:135-138, there is dead/incomplete code in the horizontal_latency() method:

auto vessel_speed = platform.vessel_speed;
if(!std::isnan(platform.vessel_speed))
{
    vessel_speed = platform.vessel_speed; // Avoid negative speed
}

The variable vessel_speed is assigned platform.vessel_speed, then conditionally assigned the same value again inside the isnan check. The comment says "Avoid negative speed" but no clamping or absolute value is applied. The local vessel_speed variable is never used — the subsequent code continues to use platform.vessel_speed directly.

Impact

Low — this is dead code that doesn't affect the output, but it suggests an incomplete implementation of a negative-speed guard or NaN check.

Files

  • cube_bathymetry/src/error_model.cpp:135-139

Suggested Fix

Either implement the intended negative-speed guard (e.g., vessel_speed = std::max(0.0, platform.vessel_speed) or std::abs(...)) and use vessel_speed in the subsequent calculations, or remove the dead code.


Authored-By: Claude Code Agent
Model: Claude Opus 4.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions