Fix /path crash on clear-terrain diffraction loss

TerrainAnalysis.deygout_diffraction/2 short-circuits to integer 0
when the path has no interior points or the principal edge nu is
below the shadow boundary, which then made Float.round/2 blow up
inside compute_loss_budget when the rest of the losses were all
floats. Multiply the diffraction value by 1.0 before it feeds into
the total so clear paths coerce cleanly without touching
TerrainAnalysis's (number()) contract.
This commit is contained in:
Graham McIntire 2026-04-12 17:50:04 -05:00
parent 8121257c59
commit 263c1bbdf5
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -380,7 +380,9 @@ defmodule MicrowavepropWeb.PathLive do
diffraction_loss = diffraction_loss =
if terrain_result do if terrain_result do
terrain_result.analysis.diffraction_db # TerrainAnalysis.deygout_diffraction returns integer 0 for clear
# paths; coerce to float so Float.round/2 below is happy.
terrain_result.analysis.diffraction_db * 1.0
else else
0.0 0.0
end end