The program:

 class Program
{
static void Main()
{
const double infinity = double.PositiveInfinity;
const double negInfinity = double.NegativeInfinity;
const double nan = double.NaN;
const double max = double.MaxValue;
const double min = double.MinValue;
const double somePositive = 12343243252423.5234;
Console.WriteLine("max< infinity = {0}", max < infinity);
Console.WriteLine("somePositiv<infinity = {0}", somePositive < infinity);
Console.WriteLine("negInfinity<-somePositiv = {0}", negInfinity < -somePositive);
Console.WriteLine("negInfinity==-infinity = {0}", negInfinity == -infinity);
Console.WriteLine("min==-max = {0}", min == -max);
Console.WriteLine("min+max==0 = {0}", min + max == );
Console.WriteLine("negInfinity+infinity==0 = {0}", negInfinity + infinity == );
Console.WriteLine("negInfinity+infinity= {0}", negInfinity + infinity);
Console.WriteLine("nan+nan= {0}", nan + nan);
Console.WriteLine("max< nan = {0}", somePositive < infinity);
Console.WriteLine("max = {0}", max);
Console.WriteLine("min = {0}", min);
Console.WriteLine("infinity = {0}", infinity);
Console.WriteLine("negInfinity = {0}", negInfinity);
Console.WriteLine("nan<infinity = {0}", nan < infinity);
}
}

The result:

max< infinity = True
somePositiv<infinity = True
negInfinity<-somePositiv = True
negInfinity==-infinity = True
min==-max = True
min+max==0 = True
negInfinity+infinity==0 = False
negInfinity+infinity= NaN
nan+nan= NaN
max< nan = True
max = 1.79769313486232E+308
min = -1.79769313486232E+308
infinity = Infinity
negInfinity = -Infinity
nan<infinity = False

The Result of an Interesting and Useful Program on Floating Numbers的更多相关文章

  1. [Amazon] Program for Fibonacci numbers 斐波那契数列

    The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21 ...

  2. 提高神经网络的学习方式Improving the way neural networks learn

    When a golf player is first learning to play golf, they usually spend most of their time developing ...

  3. How to detect and avoid memory and resources leaks in .NET applications

    By Fabrice Marguerie Despite what a lot of people believe, it's easy to introduce memory and resourc ...

  4. fio2.1.10--HOWTO

    1.0 Overview and history    ------------------------ fio was originally written to save me the hassl ...

  5. NMAP - A Stealth Port Scanner--reference

    http://nmap.org/bennieston-tutorial/ 实例:nmap -sP 192.168.21.* Contents 1  Introduction Nmap is a fre ...

  6. bsdasm

    bsdasm 来源 http://www.int80h.org/bsdasm/ Preface by G. Adam StanislavWhiz Kid Technomagic Assembly la ...

  7. Man手册--nmap

    目录 nmap使用手册 附录: nmap使用手册 附录: NMAP(1) Nmap Reference Guide NMAP(1) NAME nmap - Network exploration to ...

  8. selenium docs

    Note to the Reader - Docs Being Revised for Selenium 2.0! Introduction Test Automation for Web Appli ...

  9. [poj1113][Wall] (水平序+graham算法 求凸包)

    Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall ...

随机推荐

  1. PHP超全局变量

    PHP提供了九种超全局变量(数组) 1 $_GET //地址栏上获得的值 2 $_POST //POST表单发送的数据 3 $_REQUEST //GET和POST的内容全都有 4 $_SERVER ...

  2. 阿里云的RDS 查看binlog日志的方法

    按时间点反后台备份的binlog日志从阿里云导出来,然后用mysqlbinlog查看日志内容: # mysqlbinlog -vv --base64-output=decode-rows mysql- ...

  3. Delphi函数的返回值(注意这里与C/C++等语言有差异)

    在C/C++等语言中,函数执行到 return 部分之后,将立即停止函数的执行,并返回值 但是在Delphi中不同 函数中,执行到result时,并不同于比如 C/C++ 中的 return,跳出函数 ...

  4. MVC基础知识

    1.View中获取Control和View: //获取控制器名称: ViewContext.RouteData.Values["controller"].ToString(); / ...

  5. 2014百度之星资格赛 1001:Energy Conversion(水题,逻辑题)

    Energy Conversion Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  6. SSIS 包单元测试检查列表

    1. 使用脚本任务(Script tasks) 组建的时候,在日志里增加一些调试信息,例如变量更新信息,可以帮助我们从日志中查看到变量是在何时何地更新的. 2. 使用ForceExecutionRes ...

  7. SQL常用方言列表

    DB2 org.hibernate.dialect.DB2Dialect DB2 AS/400 org.hibernate.dialect.DB2400Dialect DB2 OS390 org.hi ...

  8. Android学习二_八:Animation的使用(一) (转)

    一.Animations介绍 Animations是一个实现android UI界面动画效果的API,Animations提供了一系列的动画效果,可以进行旋转.缩放.淡入淡出等,这些效果可以应用在绝大 ...

  9. JAVA安装,环境变量配置

    JAVA环境变量设置 PATH %JAVA_HOME%\bin JAVA_HOME D:\ProgramFiles\Java\jdk1.6.0_10 CLASSPATH .;%JAVA_HOME%\l ...

  10. 在Asp.Net MVC中实现CompareValues标签对Model中的属性进行验证

    在Asp.Net MVC中可以用继承ValidationAttribute的方式,自定制实现Model两个中两个属性值的比较验证 具体应用场景为:要对两个属性值的大小进行验证 代码如下所示: /// ...