[K/N] Internalize FloatingPointParser

As a part of efforts to stabilize K/N stdlib.
This commit is contained in:
Abduqodiri Qurbonzoda
2023-04-06 17:34:11 +03:00
parent f8d001c21f
commit 2328cf5fcf
2 changed files with 3 additions and 5 deletions
@@ -53,7 +53,7 @@ private external fun parseFloatImpl(s: String, e: Int): Float
* Used to parse a string and return either a single or double precision * Used to parse a string and return either a single or double precision
* floating point number. * floating point number.
*/ */
object FloatingPointParser { internal object FloatingPointParser {
/* /*
* All number with exponent larger than MAX_EXP can be treated as infinity. * All number with exponent larger than MAX_EXP can be treated as infinity.
* All number with exponent smaller than MIN_EXP can be treated as zero. * All number with exponent smaller than MIN_EXP can be treated as zero.
@@ -137,16 +137,14 @@ public actual inline fun String.toLong(radix: Int): Long = toLongOrNull(radix) ?
* Parses the string as a [Float] number and returns the result. * Parses the string as a [Float] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number. * @throws NumberFormatException if the string is not a valid representation of a number.
*/ */
@kotlin.internal.InlineOnly public actual fun String.toFloat(): Float = FloatingPointParser.parseFloat(this)
public actual inline fun String.toFloat(): Float = FloatingPointParser.parseFloat(this)
/** /**
* Parses the string as a [Double] number and returns the result. * Parses the string as a [Double] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number. * @throws NumberFormatException if the string is not a valid representation of a number.
*/ */
@kotlin.internal.InlineOnly public actual fun String.toDouble(): Double = FloatingPointParser.parseDouble(this)
public actual inline fun String.toDouble(): Double = FloatingPointParser.parseDouble(this)
/** /**
* Parses the string as a [Float] number and returns the result * Parses the string as a [Float] number and returns the result