Printing double value - check if it represented as exponential
This commit is contained in:
committed by
KonstantinAnisimov
parent
8b7cad339e
commit
51f74b4203
@@ -420,7 +420,9 @@ class Launcher(val numWarmIterations: Int, val numMeasureIterations: Int) {
|
|||||||
//-----------------------------------------------------------------------------//
|
//-----------------------------------------------------------------------------//
|
||||||
|
|
||||||
fun Double.toString(n: Int): String {
|
fun Double.toString(n: Int): String {
|
||||||
val str = this.toString()
|
val str = this.toString()
|
||||||
|
if (str.contains('e', ignoreCase = true)) return str
|
||||||
|
|
||||||
val len = str.length
|
val len = str.length
|
||||||
val pointIdx = str.indexOf('.')
|
val pointIdx = str.indexOf('.')
|
||||||
val dropCnt = len - pointIdx - n - 1
|
val dropCnt = len - pointIdx - n - 1
|
||||||
|
|||||||
Reference in New Issue
Block a user