diff --git a/auctionsim/summary.go b/auctionsim/summary.go index f9d9f76..cf047f2 100644 --- a/auctionsim/summary.go +++ b/auctionsim/summary.go @@ -1,6 +1,7 @@ package auctionsim import ( + "math" "strconv" ) @@ -75,7 +76,7 @@ func Summarize(price float64, allBidders []Bidder) *ResultSummary { rube = allBidders[maxIdx] } return &ResultSummary{ - Bidders: len(allbidders), + Bidders: len(allBidders), Price: price, WinnerValue: winner.Value, WinnerProfit: winner.Value - price, @@ -108,7 +109,7 @@ func ResultSummaryCSVHeader() []string { } func csvFloat(f float64) string { - return strconv.FormatFloat(f, 'g', CSVPrecision) + return strconv.FormatFloat(f, 'g', CSVPrecision, 64) } /** @@ -121,11 +122,11 @@ func (s *ResultSummary) CSVRecord() []string { csvFloat(s.Price), csvFloat(s.WinnerValue), csvFloat(s.WinnerProfit), - strconv.Itoa(LosersWithRegrets), + strconv.Itoa(s.LosersWithRegrets), csvFloat(s.HighestValue), csvFloat(s.HighestValuatorBid), csvFloat(s.MissedProfit), csvFloat(s.ValueDelta), - strconv.Itoa(HighestValueRank), + strconv.Itoa(s.HighestValueRank), } }