Add comments about floats

This commit is contained in:
James Cole
2022-10-16 14:44:11 +02:00
parent 39654249e4
commit e472c3520d
12 changed files with 36 additions and 32 deletions

View File

@@ -102,11 +102,14 @@ class AccountController extends Controller
];
$currentStart = clone $start;
$range = app('steam')->balanceInRange($account, $start, clone $end);
$previous = round((float) array_values($range)[0], 12);
// 2022-10-11: this method no longer converts to floats
$previous = array_values($range)[0];
while ($currentStart <= $end) {
$format = $currentStart->format('Y-m-d');
$label = $currentStart->toAtomString();
$balance = array_key_exists($format, $range) ? round((float) $range[$format], 12) : $previous;
$balance = array_key_exists($format, $range) ? $range[$format] : $previous;
$previous = $balance;
$currentStart->addDay();
$currentSet['entries'][$label] = $balance;