From 440a0b840495dd6610170b594780a5c06ca49d4a Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sun, 20 Nov 2011 21:47:11 +0000 Subject: [PATCH] Use strtod() to convert text to double To get improved precision when parsing pasted data in the ride editor. Fixes #477. --- src/RideEditor.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/RideEditor.cpp b/src/RideEditor.cpp index c5b470461..6b254173b 100644 --- a/src/RideEditor.cpp +++ b/src/RideEditor.cpp @@ -25,6 +25,9 @@ #include #include +// for strtod +#include + // used to make a lookup string for row/col anomalies static QString xsstring(int x, RideFile::SeriesType series) { @@ -820,7 +823,11 @@ RideEditor::getPaste(QVector >&cells, QStringList &seps, QString cells.resize(row+1); foreach (QString token, line.split(sep)) { cells[row].resize(col+1); - cells[row][col] = token.toDouble(); + + // use strtod to get better precision + char *p; + cells[row][col] = strtod(token.toLatin1(), &p); + col++; // if there are more cols than in the