双精度、字符串和整数转换问题

Problem with Double, String and Integer conversion

为什么值为 4.49504794?应该是 usdRate:String * sas * ddx:EditText.

我希望它是 0.00000001 * input 来自 edittext(来自用户)* usdRate:String(1 BTC 美元)

应该是 0.00000001/44950 * x (user_input = x) = (0,00002224694105)

我还想将 usdRate:String 限制为总共 5 位数字,或者以某种方式删除字符串中的最后四个符号。

            var usdRate:String = (JSONObject(json).getJSONObject("bpi").getJSONObject("USD")["rate"]  as String)
            val text = usdRate.replace(",", "")
            val text2 = text.replace(".", "")
            val satosh: Int = text2.toInt()
            val sas: Double = 0.00000001
            val sas2: Double = sas.toDouble() * satosh.toDouble()
            val ddx:EditText = findViewById(R.id.editTextNumber2)
            val sasEnty: Double = (ddx.text.toString().toDouble() * sas2)

                //1 satoshi value in USD
            usdView.text = sasEnty.toString()
            //Problem end 

应用程序输出图片

Output

这段代码给了我正在寻找的输出。当用户输入 3 作为值时,它会 return 0.0013994405520000002

//ex 45,000.01234
var usdRate: String = (JSONObject(json).getJSONObject("bpi").getJSONObject("USD")["rate"]  as String).toString()
val usdRateN1: String = usdRate.replace(",", "")
val sastoshi: Double = 0.00000001
var antalSatoshi = sastoshi * ddx.text.toString().toDouble()
var FinalUsdCount = (usdRateN1.toDouble() * antalSatoshi )
Math.round(FinalUsdCount)