@@ -384,7 +384,7 @@ object Firm:
384384 rng : Random ,
385385 )(using p : SimParams ): Decision =
386386 val pnl = computePnL(firm, w.hhAgg.marketWage, w.flows.sectorDemandMult(firm.sector.toInt), w.priceLevel, lendRate, w.month)
387- val ready2 = Ratio ( Math .min( 1.0 , firm.digitalReadiness.toDouble + HybridMonthlyDrDrift ))
387+ val ready2 = ( firm.digitalReadiness + Ratio ( HybridMonthlyDrDrift )).min( Ratio . One )
388388
389389 val upCapex = computeAiCapex(firm) * HybridToFullCapexMul
390390 val upLoan = upCapex * FullAiLoanShare
@@ -553,7 +553,7 @@ object Firm:
553553 diminishing * (0.5 + competitive)
554554 if canAfford && rng.nextDouble() < digiProb then
555555 val boost = p.firm.digiInvestBoost.toDouble * diminishing
556- val newDR = Ratio ( Math .min( 1.0 , firm.digitalReadiness.toDouble + boost))
556+ val newDR = ( firm.digitalReadiness + Ratio ( boost)).min( Ratio . One )
557557 Decision .DigiInvest (pnl, digiCost, newDR)
558558 else if nc < PLN .Zero then attemptDownsize(firm, pnl, nc, workers, TechState .Traditional (_), w.hhAgg.marketWage, BankruptReason .LaborCostInsolvency )
559559 else Decision .Survive (pnl, nc)
@@ -669,7 +669,7 @@ object Firm:
669669 if p.firm.digiDrift <= Ratio .Zero then return r
670670 val f = r.firm
671671 if ! isAlive(f) then return r
672- val newDR = Ratio ( Math .min( 1.0 , f.digitalReadiness.toDouble + p.firm.digiDrift.toDouble) )
672+ val newDR = ( f.digitalReadiness + p.firm.digiDrift).min( Ratio . One )
673673 r.copy(firm = f.copy(digitalReadiness = newDR))
674674
675675 /** Apply physical capital investment after firm decision. Depreciation,
@@ -813,7 +813,7 @@ object Firm:
813813 * clamped to [0, 1].
814814 */
815815 private def effectiveShadowShare (sector : SectorIdx , cyclicalAdj : Double )(using p : SimParams ): Ratio =
816- Ratio ( Math .min( 1.0 , p.informal.sectorShares.map(_.toDouble)( sector.toInt) + cyclicalAdj))
816+ ( p.informal.sectorShares( sector.toInt) + Ratio ( cyclicalAdj)).min( Ratio . One )
817817
818818 /** CIT evasion fraction for a sector — shadow share × CIT evasion rate. */
819819 private def citEvasionFrac (sector : SectorIdx , cyclicalAdj : Double )(using p : SimParams ): Ratio =
0 commit comments