pyne / pyne

PyNE: The Nuclear Engineering Toolkit
http://pyne.io/
Other
261 stars 176 forks source link

Discrepancy in Decay Calculation Between Linux and MacOS #1539

Open ahnaf-tahmid-chowdhury opened 2 weeks ago

ahnaf-tahmid-chowdhury commented 2 weeks ago

Description

While testing test_material.py on MacOS, it was observed that Nd144 with a value of 8.996484819074119e-40 is dropped when calling pyne.Material({"U235": 1.0, "H3": 1.0}).decay(365.25 * 24.0 * 3600.0). This behavior is specific to MacOS, as the same calculation works correctly on Linux. This discrepancy is causing the test to fail on MacOS.

Steps to Reproduce

  1. Create a Material instance with {"U235": 1.0, "H3": 1.0}.
  2. Call the decay method with 365.25 * 24.0 * 3600.0 as the argument.
  3. Observe that Nd144 is dropped in the resulting Material on MacOS, while it is retained on Linux.

Expected Behavior

The decay method should produce consistent results across different operating systems, retaining all isotopes including those with very small values such as Nd144 with 8.996484819074119e-40.

Actual Behavior

On MacOS, Nd144 is dropped from the resulting Material, whereas on Linux, it is retained. This inconsistency causes the test to fail on MacOS.

Environment

Logs

For more details, refer to the Workflow logs.

Additional Information

The issue appears to be related to how very small values are handled in the decay process on MacOS. Further investigation is required to determine the root cause and to implement a fix that ensures consistency across all platforms.

ahnaf-tahmid-chowdhury commented 2 weeks ago

After setting decay(1000 * 365.25 * 24.0 * 3600.0), the macOS test passed. More info can be found here. It seems that when the value is 1e-40, it gets ignored, but 1e-38 works on macOS.