54 |
54 |
55 return list.join(delimeter); |
55 return list.join(delimeter); |
56 } |
56 } |
57 |
57 |
58 |
58 |
59 void roundToDecimals(double& value, int decimals) |
59 double roundToDecimals(double value, int decimals) |
60 { |
60 { |
61 if (decimals == 0) |
61 if (decimals == 0) |
62 { |
62 { |
63 value = round(value); |
63 return round(value); |
64 } |
64 } |
65 else if (decimals > 0) |
65 else if (decimals > 0) |
66 { |
66 { |
67 qreal coefficient = pow(10, decimals); |
67 qreal coefficient = pow(10, decimals); |
68 value = round(value * coefficient) / coefficient; |
68 return round(value * coefficient) / coefficient; |
69 } |
69 } |
70 } |
|
71 |
|
72 |
|
73 void applyToMatrix(Matrix& a, ApplyToMatrixFunction func) |
|
74 { |
|
75 for (int i = 0; i < 9; ++i) |
|
76 func(i, a.value(i)); |
|
77 } |
|
78 |
|
79 void applyToMatrix(const Matrix& a, ApplyToMatrixConstFunction func) |
|
80 { |
|
81 for (int i = 0; i < 9; ++i) |
|
82 func(i, a.value(i)); |
|
83 } |
70 } |
84 |
71 |
85 QString formatFileSize(qint64 size) |
72 QString formatFileSize(qint64 size) |
86 { |
73 { |
87 static const QString suffixes[] = {" bytes", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}; |
74 static const QString suffixes[] = {" bytes", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}; |