zoukankan      html  css  js  c++  java
  • C# floating Point types

    The tradeoff between decimal and double is precision versus range. The decimal is the best choice when precision is required, but choose a double for the greatest range. The decimal
    type is well suited for financial calculations, as shown in the following example:
    decimal annualSales = 99873582948769876589348317.95m;

    A final word on literal suffixes: There are common suffixes for each literal type. Suffixes ensure that the literal is the intended type. This is good for documentation. However, the
    primary benefit is ensuring that your expressions are evaluated correctly; that is, the compiler will interpret float and decimal literals without suffixes as a double when evaluating
    an expression. To avoid the associated errors, use an appropriate literal suffix (f/F, d/D, m/M).

  • 相关阅读:
    寒假 学习进度七
    寒假学习进度
    寒假学习进度五
    寒假学习进度四
    寒假学习进度三
    寒假学习进度二
    Spark实验五
    半篇论文笔记
    REPL
    Scala基本语法及操作、程序控制结构
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1670564.html
Copyright © 2011-2022 走看看