Java資料有效位數工具類

2021-06-27 21:36:14 字數 801 閱讀 6756

package com.yqq.test;

public class adjustmentdouble

//小數部分精度大於或等於指定的精度

if(numofdecimalpart<=array[1].length())

//小數部分精度小於指定的精度

if(numofdecimalpart>array[1].length())else}}

//小數部分精度大於或等於指定的精度

if(numofdecimalpart<=array[1].length())

//小數部分精度小於指定的精度

if(numofdecimalpart>array[1].length())else}}

//小數部分精度大於或等於指定的精度

if(numofdecimalpart<=array[1].length())

}if(numofdecimalpart==0)

return string.valueof(tempa2)+"."+string.valueof(tempb);

}//情況(6)

if((array[0].length()for(int i = 0 ; i < numofdecimalpart -array[1].length() ; i++)

return s;

}return null; }

/*** @param args

*/public static void main(string args)

}

Python工具 保留小數的指定有效位數

處理乙個資料檔案,發現資料不一致,小數點後有三位 四位 六位 更多位。部分還進行四捨五入。需要對資料檔案進行處理。如果有效位超過6位,則四捨五入。如果小於6位,則保持原來的數字不變。考慮兩種情況 小數點後無數字 判斷數字有效位 len str num 1 是否超過6,超過則通過整除去尾,沒有則返回 ...

C 檢驗資料有效性驗證類

using system using system.text using system.text.regularexpressions namespace dachie.common d 0?1 9 1 0 2 0?1 9 1 2 0 9 30 31 private const string reg...

C 檢驗資料有效性驗證類

using system using system.text using system.text.regularexpressions namespace dachie.common d 0?1 9 1 0 2 0?1 9 1 2 0 9 30 31 private const string reg...