相关疑难解决方法(0)

我应该使用double还是float?

在C++中使用一个而不是另一个有什么优缺点?

c++ floating-point types double-precision

80
推荐指数
5
解决办法
8万
查看次数

Android/SQLite:保存/检索REAL类型的数据

我有一个带字段REAL的SQLDB.在我的布局中,我将其字段大小设置为仅允许8 + 2位数.在我的对象中,我使用了字段的数据类型为"float".

qs[0] = "CREATE TABLE " + RELATION_TABLE_NAME + "(id TEXT PRIMARY KEY, name TEXT NOT NULL, startBal REAL NOT NULL, currentBal REAL NOT NULL);";

<EditText android:text="" android:id="@+id/relCurrBalTxt" style="@style/EditTextStyle"
 android:inputType="numberDecimal" android:maxLength="11" android:hint="12345678.99" />
Run Code Online (Sandbox Code Playgroud)

我在editText中输入值"87654321.99",然后单击"保存".它填充对象

// Send the data to object 
rowData.setValue(2, Float.parseFloat(sbalTxt.getText().toString()));
// In object, this is how I save it
this.setCurrentBalance( ((Float)value).floatValue() );  // value is Object type

// Saving data in ContenteValues to save to DB
// LOG Rcvd from Object while Saving CurrBal: 8.765432E7
values.put("currentBal", …
Run Code Online (Sandbox Code Playgroud)

sqlite floating-point formatting android

2
推荐指数
1
解决办法
1万
查看次数