The Result of an Interesting and Useful Program on Floating Numbers
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的更多相关文章
- [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 ...
- 提高神经网络的学习方式Improving the way neural networks learn
When a golf player is first learning to play golf, they usually spend most of their time developing ...
- 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 ...
- fio2.1.10--HOWTO
1.0 Overview and history ------------------------ fio was originally written to save me the hassl ...
- NMAP - A Stealth Port Scanner--reference
http://nmap.org/bennieston-tutorial/ 实例:nmap -sP 192.168.21.* Contents 1 Introduction Nmap is a fre ...
- bsdasm
bsdasm 来源 http://www.int80h.org/bsdasm/ Preface by G. Adam StanislavWhiz Kid Technomagic Assembly la ...
- Man手册--nmap
目录 nmap使用手册 附录: nmap使用手册 附录: NMAP(1) Nmap Reference Guide NMAP(1) NAME nmap - Network exploration to ...
- selenium docs
Note to the Reader - Docs Being Revised for Selenium 2.0! Introduction Test Automation for Web Appli ...
- [poj1113][Wall] (水平序+graham算法 求凸包)
Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall ...
随机推荐
- 按键的使用(一)------verilog
按键在项目中应用还是很频繁的,这里主要介绍按键的几种用法. 1.按下一次有效:按下一次计数器增加一下. 2.按下连续有效:按下不松,计数器就一直增加. 3.按下无效,松开有效:按下时计数器值不变,按键 ...
- ASP.NET Web API中使用GZIP 或 Deflate压缩
对于减少响应包的大小和响应速度,压缩是一种简单而有效的方式. 那么如何实现对ASP.NET Web API 进行压缩呢,我将使用非常流行的库用于压缩/解压缩称为DotNetZip库.这个库可以使用Nu ...
- 【openGL】关于画点
#include "stdafx.h" #include <GL/glut.h> #include <stdlib.h> #include <math ...
- Swipe to back not working滑动后退功能消失?
如果你发现滑动后退功能突然失效了,很可能是因为你隐藏了NavigationBar 或者定制了 leftBarButtonItem(s) 这会导致 NavigationController 的 inte ...
- PHP+Nginx环境搭配
一.Nginx安装 nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息. 正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好. u ...
- <转>WCF中出现死锁或者超时
WCF回调中的死锁 一.服务器端死锁 对于如下服务: [ServiceContract(CallbackContract = typeof(INotify))] public class Downlo ...
- 限制非安全IP访问
这个是一个检测ip是否非法的php函数,适应于白名单,黑名单功能开发,主要场景应用于:api来源限制,访问限制等. /** * 安全IP检测,支持IP段检测 * @param string $ip 要 ...
- [JavaCore]JAVA中的泛型
JAVA中的泛型 [更新总结] 泛型就是定义在类里面的一个类型,这个类型在编写类的时候是不确定的,而在初始化对象时,必须确定该类型:这个类型可以在一个在里定义多个:在一旦使用某种类型,在类方法中,那么 ...
- C# jsonhelper
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Sc ...
- BZOJ 1861: [Zjoi2006]Book 书架 splay
1861: [Zjoi2006]Book 书架 Description 小T有一个很大的书柜.这个书柜的构造有些独特,即书柜里的书是从上至下堆放成一列.她用1到n的正整数给每本书都编了号. 小T在看书 ...