比如:double,怎样让他小数点后变成最大长度。

解决方案 »

  1.   

    如果是转化为字符串的话,如下:
    double dValue = 1.333f;
    string strDouble = dValue.ToString( "f4" );//strDouble is "1.3330"
      

  2.   

    double dValue = 1.333f;
    string strDouble = dValue.ToString( "0.00" );//strDouble is "1.33"
      

  3.   

    double类型可以设置小数后最多14位数值,有没有比这个更长的类型呢
      

  4.   

    The Decimal Data TypeDecimal variables are stored as signed 128-bit (16-byte) integers scaled by a variable power of 10. The scaling factor specifies the number of digits to the right of the decimal point; it ranges from 0 through 28. With a scale of 0 (no decimal places), the largest possible value is +/-79,228,162,514,264,337,593,543,950,335. With 28 decimal places, the largest value is +/-7.9228162514264337593543950335, and the smallest nonzero value is +/-0.0000000000000000000000000001 (+/-1E-28).Appending the literal type character D to a literal forces it to the Decimal data type. Appending the identifier type character @ to any identifier forces it to Decimal. You might need to use the D type character to assign a large value to a Decimal variable or constant, as the following example shows:Dim BigDec1 As Decimal = 9223372036854775807   ' No overflow.
    Dim BigDec2 As Decimal = 9223372036854775808   ' Overflow.
    Dim BigDec3 As Decimal = 9223372036854775808D  ' No overflow.
    This is because without a literal type character the literal is taken as Long, and the value to be assigned to BigDec2 is too large for the Long type.The equivalent .NET data type is System.Decimal.