Skip to content

Commit

Permalink
Converting from int to double (3 digits of precision)
Browse files Browse the repository at this point in the history
  • Loading branch information
foralost committed Feb 3, 2024
1 parent 0ec2409 commit 1a867fe
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class HabitsCSVExporter(
val dateFormat = DateFormats.getCSVDateFormat()
for ((timestamp, value) in entries.getKnown()) {
val date = dateFormat.format(timestamp.toJavaDate())
out.write(String.format(Locale.US, "%s,%d\n", date, value))
out.write(String.format(Locale.US, "%s,%.3f\n", date, value.toDouble() / 1000.0))
}
out.close()
}
Expand Down Expand Up @@ -167,7 +167,7 @@ class HabitsCSVExporter(
checksWriter.write(sb.toString())
scoresWriter.write(sb.toString())
for (j in selectedHabits.indices) {
checksWriter.write(checkmarks[j][i].value.toString())
checksWriter.write(String.format("%.3f", checkmarks[j][i].value.toDouble() / 1000.0))
checksWriter.write(delimiter)
val score = String.format(Locale.US, "%.4f", scores[j][i].value)
scoresWriter.write(score)
Expand Down

0 comments on commit 1a867fe

Please sign in to comment.