From c14aa2fa8a204053fb5ffa2168f360a5433bdc96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=BA=86=E6=B3=89?= Date: Fri, 11 Nov 2022 16:41:06 +0800 Subject: [PATCH] Update uts-for-android.md --- docs/plugin/uts-for-android.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/plugin/uts-for-android.md b/docs/plugin/uts-for-android.md index 17a38a944..220ac39a1 100644 --- a/docs/plugin/uts-for-android.md +++ b/docs/plugin/uts-for-android.md @@ -452,6 +452,25 @@ let intent = new Intent(getUniActivity(),DemoActivity().javaClass); getUniActivity()!.startActivity(intent); ``` +#### 4.1.11 指定double数据类型 + +某些场景下开发者需要获得 指定double数据类型的数据 + +前端常用的写法: +``` +let a:Int =3 +let b:Int =4 +let c:Double = a/b +``` + +但是Android原生环境中,数据类型的精度是向下兼容的,如果想要获得一个double类型,必须要有一个double类型参与运算: + +``` +let a:Int =3 +let b:Int =4 +let c:Double = a * 1.0 / b +``` + --------------------------------- -- GitLab