bigdecimal

bigdecimalbigdecimal
  1. For this reason , BigDecimal gives you explicit control over rounding when performing division operations .

    出于这个原因,在进行除法运算时,BigDecimal可以让您显式地控制舍入。

  2. If you need to represent fixed point numbers , such as dollars and cents , use BigDecimal instead .

    如果需要表示定点数(譬如,几美元和几美分),则使用BigDecimal。

  3. Arithmetic on BigDecimal values is provided by methods for addition , subtraction , multiplication , and division .

    用于加、减、乘和除的方法给BigDecimal值提供了算术运算。

  4. Because BigDecimal objects are immutable , each of these methods produces a new BigDecimal object .

    由于BigDecimal对象是不可变的,这些方法中的每一个都会产生新的BigDecimal对象。

  5. Thus , using simple data types , such as string , integer , float , and even BigDecimal , are natural .

    因此,可以自然地使用简单的数据类型,比如string、integer、float,甚至是BigDecimal。

  6. Conversion from BigDecimal objects into Float numbers had a problem which enables attackers to effectively cause segmentation faults .

    将BigDecimal对象转换成Float数的时候会导致一个问题,这个问题使得攻击者能够很容易得到段错误。

  7. If you are looking to represent exact quantities such as monetary amounts , BigDecimal is well-suited to the task .

    如果您正在寻找一种能精确表示如货币量这样的数值,则BigDecimal可以很好地胜任该任务。

  8. Next , I need to exchange primitive datatypes ( like double , int , and float ) for objects like Integer and BigDecimal .

    接下来,我需要将基本数据类型(如,double、int和float)转换为诸如Integer和BigDecimal的对象。

  9. BigDecimal is a standard class , with no special support in the compiler , to represent arbitrary-precision decimal numbers and perform arithmetic on them .

    BigDecimal是标准的类,在编译器中不需要特殊支持,它可以表示任意精度的小数,并对它们进行计算。

  10. Given a row , you call an appropriate updateXXX () method , where XXX is replaced by the appropriate Java data type & for example , BigDecimal .

    给定一行,调用相应的updateXXX()方法,其中XXX将被替换为相应的Java数据类型&例如,BigDecimal。

  11. Of course , if you really do need the extra precision , then you 'll need to pick a data type with more precision , such as a double or a BigDecimal .

    当然,如果一定需要额外的精度,则可以选择具有高精度的数据类型,比如double或BigDecimal。

  12. As a result , BigDecimal is not well-suited for intensive numeric calculation because of the object creation overhead , but it is designed for representing exact decimal numbers .

    因此,因为创建对象的开销,BigDecimal不适合于大量的数学计算,但设计它的目的是用来精确地表示小数。

  13. You should be careful with the BigDecimal ( double ) constructor because it can allow rounding errors to sneak into your calculations before you know it .

    要小心使用BigDecimal(double)构造函数,因为如果不了解它,会在计算过程中产生舍入误差。

  14. Improper use of the BigDecimal ( double ) constructor can show up as strange-seeming exceptions in JDBC drivers when passed to the JDBC setBigDecimal () method .

    如果使用BigDecimal(double)构造函数不恰当,在传递给JDBCsetBigDecimal()方法时,会造成似乎很奇怪的JDBC驱动程序中的异常。

  15. Instead , construct the BigDecimal using BigDecimal (" 0.01 ") or BigDecimal ( 1,2 ) to avoid this problem , since either of these will result in an exact decimal representation .

    相反,使用BigDecimal(“0.01”)或BigDecimal(1,2)构造BigDecimal来避免这类问题,因为这两种方法都可以精确地表示小数。

  16. Internally , BigDecimal is represented as an arbitrary-precision unscaled value and a scale factor , which represents how many places to move the decimal point left to obtain the scaled value .

    在内部,可以用任意精度任何范围的值和一个换算因子来表示BigDecimal,换算因子表示左移小数点多少位,从而得到所期望范围内的值。