Skip to content

floating-point-underflow in MainSequence::CalculateRadiusOnPhase() #1258

@jeffriley

Description

@jeffriley

Running COMPAS with:

./compas -n1 --random-seed 1724542090 --kick-magnitude-distribution ZERO --critical-mass-ratio-prescription NONE --common-envelope-alpha 1.6265542767303343 --wolf-rayet-multiplier 0.8084912681292984 --initial-mass-function KROUPA --mass-ratio-distribution DUQUENNOYMAYOR1991

results in a floating-point underflow in in MainSequence::CalculateRadiusOnPhase() in the following statement:

double tau_40 = tau_10 * tau_10 * tau_10 * tau_10;

because the value of tau is 1.16432e-09, and tau_10 is 4.57833e-90. tau is calculated in this statement:

double tau = p_Time / timescales(tMS);                // Hurley et al. 2000, eq 11

where timescales(tMS) is 490656.

p_Mass = 0.26822, p_Time = 0.000571279, p_RZAMS = 0.2779, and timescales(tBGB) = 516480

To Reproduce
Run COMPAS with:

./compas -n1 --random-seed 1724542090 --kick-magnitude-distribution ZERO --critical-mass-ratio-prescription NONE --common-envelope-alpha 1.6265542767303343 --wolf-rayet-multiplier 0.8084912681292984 --initial-mass-function KROUPA --mass-ratio-distribution DUQUENNOYMAYOR1991

Expected behavior
Production code does not cause floating-point underflow

**Versioning

OS: Ubuntu 22.04
COMPAS v03.07.01

Also, typo in this comment could be fixed at the same time the issue is addressed:

// pow() is slow - use multipliaction where it makes sense

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity_majorThis is a severe bugurgency_moderateThis is a moderately urgent issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions