Design decisions

315. A path length is an Int, whatever the weight's range (2026-11-22)

  • Call. Distances that matrix(), floyd_warshall, dijkstra and the other path functions store are Int (64-bit), not the weight's declared range: w: 1..=1e9 bounds each edge, and a sum of two edges may exceed it without a trap. Pinned by std-graph/floyd-warshall-range-weights-sum-past-range.cp, which passes today.
  • Why. Rebuild rounds 5 and 6 both stopped here (H-RANGE-WEIGHT-SUM, H-FW-WEIGHT-WIDTH); chapter 3 says values compute in 64 bits and ranges narrow storage only where written, and a statement bound on an edge is not a bound on a path. Trapping would make the obvious program wrong.
  • Reverse. Make the matrix [V, V]?W with range stores checked, and change the case to expect the trap.