1 exec sp_executesql N'SELECT 2 [Extent2].[Id] AS [Id], 3 [Extent2].[Name] AS [Name], 4 [Extent2].[Description] AS [Description], 5 [Extent2].[RoleTypeNum] AS [RoleTypeNum], 6 [Extent2].[IsDeleted] AS [IsDeleted], 7 [Extent2].[AddDate] AS [AddDate],
/** * parse double f to num decimals * @param f * @param num the decimal number * @return the format number */ public double decimalNum(double f, int num) { BigDecimal bg = new BigDecimal(f); double f1 = bg.setScale(num, BigDecimal.ROUND_HALF_UP).dou
Java中double类型的数据精确到小数点后两位 多余位四舍五入,四种方法 一: double f = 111231.5585;BigDecimal b = new BigDecimal(f); double f1 = b.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); 二: new java.text.DecimalFormat("#.00").format(3.1415926) 三: double d = 3.1415926
import java.math.BigDecimal; import java.text.NumberFormat; public class Java中double类型的数据精确到小数点后两位 { /** * @param args */ public static void main(String[] args) { //1 double f = 749.1666666666666; BigDecimal b = new BigDecimal(f); double f1 = b.setSc
1.功能 将double类型变量进行四舍五入,并保留小数点后位数 2.代码 import java.math.BigDecimal; import java.math.RoundingMode; import java.text.DecimalFormat; import java.text.NumberFormat; public class Test { /** * 保留两位小数,四舍五入 * @param d * @return */ public static double format
4种方法,都是四舍五入,例: import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberFormat; public class format { double f = 111231.5585; public void m1() { BigDecimal bg = new BigDecimal(f); double f1 = bg.setScale(2, BigDecimal.ROUND