Skip to content

Unqualified abs() causes NaNs and missing dispersion roots with GCC 15 #2

Description

@YuanYusung

Problem

On macOS Apple Silicon with GCC 15.2, forward returns no Rayleigh-wave dispersion points for a valid layered model.

Dense secular-function scans show that most values become NaN.

Cause

Several floating-point expressions in src/secfunc.cc use unqualified abs():

wvnom = abs(wvno - xkb);

In this build, the integral overload is selected. For example, a difference of about 0.998 becomes 0, causing rb = 0 and eventually 0 / 0 -> NaN.

src/disp.cc contains a similar call in the adaptive sampling logic.

Suggested fix

Include <cmath> and use std::abs() consistently:

#include <cmath>

wvnom = std::abs(wvno - xkb);

Environment: macOS Apple Silicon, GCC 15.2.0, Eigen 3.4.1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions