Vc设置:全国的参数7组(0.32 0.33 0.35 0.100 8.36 8.35 8.81)
Archive for 7月, 2008
http://www.vec×64.com/WindowsBuilds.html
1。如何更新服务器列表!
方法之一:
在“选项”—“服务器”里面,然后点击第3项后面的“列表”,会打开写字板,把以下的每日更新的服务器列表拷贝到里面:
http://www.srv1000.com/x1/server.met
http://emule.945.cn/server.met
http://www.edk-files.com/x1/server.met
方法之二:
推荐一个每天都更新的世界服务器列表的网站:
网页左下方有个 Home (server.met) 文件,点击进入另外一个网页,出现下面的内容:
connect list: server.met (add to eMule) 2.9kB (25 servers)
best servers: server.met (add to eMule) 6.7kB (63 servers)
all servers: server.met (add to eMule) 9.9kB (94 servers)
选择最下面的一个,点击(add to eMule)就可以把所有的服务器自动添加到eMule当中。
补充说明:何时应该更新服务器列表,更新之后有什么好处吗!?
如果你的连接没有什么问题,下载都一切正常的话没就有必要经常更新服务器列表。如果哪天连接服务器总是失败或超时的话,可以试着更新一下服务器列
表。或许会有帮助。一般来说,其实只要你选中“选项”—“连接”里面的“连接到服务器时自动更新服务器列表”和“连接到其他客户时更新服务器列表”这两项
的话。你的服务器列表一般都可以保证没有问题。另外,更新服务器列表的优点就是:更新之后能在更大的范围内搜索文件!
08-07-21
服务器列表
http://www.emule.org.cn/server.met
http://www.srv1000.com/x1/server.met
http://emule.945.cn/server.met
http://www.edk-files.com/x1/server.met
http://ed2k.2×4u.de/yvwu4n0d/micro/server.met
http://ed2k.2×4u.de/yvwu4n0d/min/server.met
http://ed2k.2×4u.de/yvwu4n0d/max/server.met
如须转载请注明作者为Lolita@linuxsir.org,并请保持文章的完整和提供转载出处。
更新:
20060623-06:44 增加了求最大非规格数的公式
20060622-23:40 修改了几处笔误,换掉了实验部分的那张大图,改用代码显示。
一、背景
在IEEE标准754之前,业界并没有一个统一的浮点数标准,相反,很多计算机制造商都设计自己的浮点数规则,以及运算细节。那时,实现的速度和简易性比数字的精确性更受重视。
直到1985年Intel打算为其的8086微处理器引进一种浮点数协处理器的时候,聪明地意识到,作为设计芯片者的电子工程师和固体物理学家们,也许并不能通过数值分析来选择最合理的浮点数二进制格式。于是Intel在请加州大学伯克利分校的 William Kahan教授──最优秀的数值分析家之一来为8087 FPU设计浮点数格式; 而这个家伙又找来两个专家来协助他,于是就有了KCS组合(Kahn, Coonan, and Stone)。 他们共同完成了Intel的浮点数格式设计,而且完成地如此出色,以致于IEEE组织决定采用一个非常接近KCS的方案作为IEEE的标准浮点格式。目前,几乎所有计算机都支持该标准,大大改善了科学应用程序的可移植性。
二、表示形式
从表面上看,浮点数也是一串0和1构成的位序列(bit sequence),并不是三头六臂的怪物,更不会咬人。然而IEEE标准从逻辑上用三元组{S,E,M}表示一个数N,如下图所示:

N的实际值n由下列式子表示:

其中:
★ n,s,e,m分别为N,S,E,M对应的实际数值,而N,S,E,M仅仅是一串二进制位。
★ S(sign)表示N的符号位。对应值s满足:n>0时,s=0; n<0时,s=1。
★ E(exponent)表示N的指数位,位于S和M之间的若干位。对应值e值也可正可负。
★ M(mantissa)表示N的尾数位,恰好,它位于N末尾。M也叫有效数字位(sinificand)、系数位(coefficient), 甚至被称作“小数”。
三、浮点数格式
IEEE标准754规定了三种浮点数格式:单精度、双精度、扩展精度。前两者正好对应C语言里头的float、double或者FORTRAN里头的real、double精度类型。限于篇幅,本文仅介绍单精度、双精度浮点格式。
★ 单精度:N共32位,其中S占1位,E占8位,M占23位。

★ 双精度:N共64位,其中S占1位,E占11位,M占52位。

值得注意的是,M虽然是23位或者52位,但它们只是表示小数点之后的二进制位数,也就是说,假定 M为“010110011…”, 在二进制数值上其实是“.010110011…”。而事实上,标准规定小数点左边还有一个隐含位,这个隐含位通常,哦不,应该说绝大多数情况下是1,那什么情况下是0呢?答案是N对应的n非常小的时候,比如小于 2^(-126)(32位单精度浮点数)。不要困惑怎么计算出来的,看到后面你就会明白。总之,隐含位算是赚来了一位精度,于是M对应的m最后结果可能是”m=1.010110011…”或者“m=0.010110011…”
四、计算e、m
首先将提到令初学者头疼的“规格化(normalized)”、“非规格化(denormalized)”。噢,其实并没有这么难的,跟我来!掌握它以后你会发现一切都很优雅,更美妙的是,规格化、非规格化本身的概念几乎不怎么重要。请牢记这句话:规格化与否全看指数E!
下面分三种情况讨论E,并分别计算e和m:
1、规格化:当E的二进制位不全为0,也不全为1时,N为规格化形式。此时e被解释为表示偏置(biased)形式的整数,e值计算公式如下图所示:

上图中,|E|表示E的二进制序列表示的整数值,例如E为”10000100″,则|E|=132,e=132-127=5 。 k则表示E的位数,对单精度来说,k=8,则bias=127,对双精度来说,k=11,则bias=1023。
此时m的计算公式如下图所示:

标准规定此时小数点左侧的隐含位为1,那么m=|1.M|。如M=”101″,则|1.M|=|1.101|=1.625,即 m=1.625
2、非规格化:当E的二进制位全部为0时,N为非规格化形式。此时e,m的计算都非常简单。

注意,此时小数点左侧的隐含位为0。 为什么e会等于(1-bias)而不是(-bias),这主要是为规格化数值、非规格化数值之间的平滑过渡设计的。后文我们还会继续讨论。
有了非规格化形式,我们就可以表示0了。把符号位S值1,其余所有位均置0后,我们得到了 -0.0; 同理,把所有位均置0,则得到 +0.0。非规格化数还有其他用途,比如表示非常接近0的小数,而且这些小数均匀地接近0,称为“逐渐下溢(gradually underflow)”属性。
3、特殊数值: 当E的二进制位全为1时为特殊数值。此时,若M的二进制位全为0,则n表示无穷大,若S为1则为负无穷大,若S为0则为正无穷大; 若M的二进制位不全为0时,表示NaN(Not a Number),表示这不是一个合法实数或无穷,或者该数未经初始化。
五、范例
仔细研读第四点后,再回忆一下文章开头计算n的公式,你应该写出一个浮点编码的实际值n了吧? 还不能吗?不急,我先给你示范一下。我们假定N是一个8位浮点数,其中,S占1位,E占4位,M占3位。下面这张表罗列了N可能的正数形式,也包含了e、m等值,请你对照着这张表,重温一下第四点,你会慢慢明白的。说实在的,这张表花了我不少功夫呢,幸好TeX画表格还算省事!

这张表里头有很多有趣的地方,我提醒一下:
★ 看 N 列,从上到下,二进制位表示是均匀递增的,且增量都是一个最小二进制位。这不是偶然,正是巧妙设计的结果。观察最大的非规格数,发现恰好就是M全为1, E全为0的情况。于是我们求出最大的非规格数为:

上面的公式中,h为M的位数(如范例中为3)。注意,公式等号右边的第一项同时又是最小规格数的值(如范例中为 8/512 );第二项则正是最小非规格数的值(如范例中为1/512)即该浮点数能表示的最小正数。
★ 看 m 列,规格化数都是 1+ x 的形式,这个1正是隐含位1; 而非规格化数隐含位为0, 所以没有 “1+” 。
★ 看 n 列,非规格化数从上到下的增量都是 1/512, 且过渡到规格化数时,增量是平滑的,依旧是1/512。这正是非规格化数中e等于(1-bias)而不是(-bias)的缘故,也是巧妙设计的结果。 再继续往下看,发现增量值逐渐增大。可见,浮点数的取值范围不是均匀的。
六、实战
我们用一小段汇编来测试一下,浮点数在内存中是如何表示的。测试环境: GentooLinux2006.0/GNU assembler version 2.16.1/GNU gdb 6.4/AMD XP1600+。 如下所示
~/coding/assemble $ gdb(gdb) list1 .section .data2 f1:3 .float 54 f2:5 .float 0.1 6 .section .text7 .global _start8 _start:9 nop10 (gdb) x/f &f10x80490a4 <f1>: 5(gdb) x/xw &f10x80490a4 <f1>: 0x40a00000(gdb) x/f &f20x80490a8 <f2>: 0.100000001(gdb) x/xw &f20x80490a8 <f2>: 0x3dcccccd(gdb)
从上面的gdb命令结果可以看出,浮点数5被表示为 0×40a00000,二进制形式为( 0100 0000 1010 0000 … 0000 0000)。红色数字为E,可以看出|E|=129>0, 则e=129-bias=129-127=2 ; 蓝色数字为M, 且|E|>0,说明是规格化数,则m=|1.M|=|1.01000..000|=1.25 ; 由n的计算公式可以求得 n=(-1)^0 * 1.25 * 2^2 = 5, 结果被验证了。
同样,你也可以验证一下十进制浮点数0.1的二进制形式是否正确,你会发现,0.1不能表示为有限个二进制位,因此在内存中的表示是舍入(rounding)以后的结果,即 0×3dcccccd, 十进制为0.100000001, 误差0.000000001由此产生了。
七、未完成
关于浮点数,还有很多东西(比如舍入误差、除零异常等等)值得我们深入探讨,但已经无法在此继续。这篇文章的目的仅在初步解释IEEE标准754对浮点数的规定以及一些奇妙的地方。写这篇文章花掉了我整天的时间,但也使我彻底记住了以前让我胆怯的东西──最重要的是,希望这篇文章对大家有点用处,也算我为计算机科学基础理论版以及Linuxsir.org做的一点贡献。
参考书目:
①: Randall Hyde, The Art of Assembly Language, Vol.1, 4.2.1
②: Randal E. Bryant, David R. O’Hallaron, Computer Systems A Programmer’s Perspective (Beta Draft), PartⅠ, Chapt.Ⅱ, 2.4
③: Rechard Blum, Professional Assembly Language
IEEE Standard 754 floating point is the most common
representation today for real numbers on computers, including
Intel-based PC’s, Macintoshes, and most Unix platforms. This article
gives a brief overview of IEEE floating point and its representation.
Discussion of arithmetic implementation may be found in the book
mentioned at the bottom of this article.
What Are Floating Point Numbers?
There are several ways to represent real numbers on
computers. Fixed point places a radix point somewhere in the middle of
the digits, and is equivalent to using integers that represent portions
of some unit. For example, one might represent 1/100ths of a unit; if
you have four decimal digits, you could represent 10.82, or 00.01.
Another approach is to use rationals, and represent every number as the
ratio of two integers.
Floating-point representation - the most common solution -
basically represents reals in scientific notation. Scientific notation
represents numbers as a base number and an exponent. For example,
123.456 could be represented as 1.23456 x 102. In hexadecimal, the number 123.abc might be represented as 1.23abc x 162.
Floating-point solves a number of representation problems.
Fixed-point has a fixed window of representation, which limits it from
representing very large or very small numbers. Also, fixed-point is
prone to a loss of precision when two large numbers are divided.
Floating-point, on the other hand, employs a sort of “sliding
window” of precision appropriate to the scale of the number. This
allows it to represent numbers from 1,000,000,000,000 to
0.0000000000000001 with ease.
S×age Layout
IEEE floating point numbers have three basic
components: the sign, the exponent, and the mantissa. The mantissa is
composed of the fraction and an implicit leading digit (explained below). The exponent base (2) is implicit and need not be s×ed.
The following figure shows the layout for single (32-bit) and
double (64-bit) precision floating-point values. The number of bits for
each field are shown (bit ranges are in square brackets):
| Sign | Exponent | Fraction | Bias | |
|---|---|---|---|---|
| Single Precision | 1 [31] | 8 [30-23] | 23 [22-00] | 127 |
| Double Precision | 1 [63] | 11 [62-52] | 52 [51-00] | 1023 |
The Sign Bit
The sign bit is as simple as it gets. 0 denotes a
positive number; 1 denotes a negative number. Flipping the value of
this bit flips the sign of the number.
The Exponent
The exponent field needs to represent both positive and negative exponents. To do this, a bias
is added to the actual exponent in order to get the s×ed exponent.
For IEEE single-precision floats, this value is 127. Thus, an exponent
of zero means that 127 is s×ed in the exponent field. A s×ed value
of 200 indicates an exponent of (200-127), or 73. For reasons discussed
later, exponents of -127 (all 0s) and +128 (all 1s) are reserved for
special numbers.
For double precision, the exponent field is 11 bits, and has a bias of 1023.
The Mantissa
The mantissa, also known as the significand, represents the precision bits of the number. It is composed of an implicit leading bit and the fraction bits.
To find out the value of the implicit leading bit, consider that
any number can be expressed in scientific notation in many different
ways. For example, the number five can be represented as any of these:
5.00 x 10<sup>0</sup><br /> 0.05 x 10<sup>2</sup><br /> 5000 x 10<sup>-3</sup><br /></pre> <p class="noindent">In order to maximize the quantity of representable numbers, floating-point numbers are typically s×ed in <dfn>normalized</dfn> form. This basically puts the radix point after the first non-zero digit. In normalized form, five is represented as 5.0 x 10<sup>0</sup>. </p><p>A nice little optimization is available to us in base two, since the only possible non-zero digit is 1. Thus, we can just assume a leading digit of 1, and don't need to represent it explicitly. As a result, the mantissa has effectively 24 bits of resolution, by way of 23 fraction bits. </p><h3>Putting it All Together</h3> <p class="noindent">So, to sum up: </p><p> </p><ol class="indent"><li>The sign bit is 0 for positive, 1 for negative. </li><li>The exponent's base is two. </li><li>The exponent field contains 127 plus the true exponent for single-precision, or 1023 plus the true exponent for double precision. </li><li>The first bit of the mantissa is typically assumed to be 1.<i>f</i>, where <i>f</i> is the field of fraction bits. </li></ol> <h2 id="ranges">Ranges of Floating-Point Numbers</h2> <p class="noindent">Let's consider single-precision floats for a second. Note that we're taking essentially a 32-bit number and re-jiggering the fields to cover a much broader range. Something has to give, and it's precision. For example, regular 32-bit integers, with all precision centered around zero, can precisely s×e integers with 32-bits of resolution. Single-precision floating-point, on the other hand, is unable to match this resolution with its 24 bits. It does, however, approximate this value by effectively truncating from the lower end. For example: </p><pre> 11110000 11001100 10101010 00001111 // 32-bit integer<br /> = +1.1110000 11001100 10101010 x 2<sup>31</sup> // Single-Precision Float<br /> = 11110000 11001100 10101010 00000000 // Corresponding Value<br />
This approximates the 32-bit value, but doesn’t
yield an exact representation. On the other hand, besides the ability
to represent fractional components (which integers lack completely),
the floating-point value can represent numbers around 2127, compared to 32-bit integers maximum value around 232.
The range of positive floating point numbers can be split into
normalized numbers (which preserve the full precision of the mantissa),
and denormalized numbers (discussed later) which use only a portion of the fractions’s precision.
| Denormalized | Normalized | Approximate Decimal | |
|---|---|---|---|
| Single Precision | ± 2-149 to (1-2-23)x2-126 | ± 2-126 to (2-2-23)x2127 | ± ~10-44.85 to ~1038.53 |
| Double Precision | ± 2-1074 to (1-2-52)x2-1022 | ± 2-1022 to (2-2-52)x21023 | ± ~10-323.3 to ~10308.3 |
Since the sign of floating point numbers is given by a special
leading bit, the range for negative numbers is given by the negation of
the above values.
There are five distinct numerical ranges that single-precision floating-point numbers are not able to represent:
- Negative numbers less than -(2-2-23) x 2127 (negative overflow)
- Negative numbers greater than -2-149 (negative underflow)
- Zero
- Positive numbers less than 2-149 (positive underflow)
- Positive numbers greater than (2-2-23) x 2127 (positive overflow)
Overflow means that values have grown too large for the
representation, much in the same way that you can overflow integers.
Underflow is a less serious problem because is just denotes a loss of
precision, which is guaranteed to be closedly approximated by zero.
Here’s a table of the effective range (excluding infinite values) of IEEE floating-point numbers:
| Binary | Decimal | |
|---|---|---|
| Single | ± (2-2-23)127 | ~ ± 1038.53 |
| Double | ± (2-2-52)1023 | ~ ± 10308.25 |
Note that the extreme values occur (regardless of sign) when the exponent is at the maximum value for finite numbers (2127 for single-precision, 21023 for double), and the mantissa is filled with 1s (including the normalizing 1 bit).
Special Values
IEEE reserves exponent field values of all 0s and all 1s to denote special values in the floating-point scheme.
Zero
As mentioned above, zero is not directly
representable in the straight format, due to the assumption of a
leading 1 (we’d need to specify a true zero mantissa to yield a value
of zero). Zero is a special value denoted with an exponent field of
zero and a fraction field of zero. Note that -0 and +0 are distinct
values, though they both compare as equal.
Denormalized
If the exponent is all 0s, but the fraction is non-zero (else it would be interpreted as zero), then the value is a denormalized number, which does not have an assumed leading 1 before the binary point. Thus, this represents a number (-1)s x 0.f x 2-126, where s is the sign bit and f is the fraction. For double precision, denormalized numbers are of the form (-1)s x 0.f x 2-1022. From this you can interpret zero as a special type of denormalized number.
Infinity
The values +infinity and -infinity are denoted with
an exponent of all 1s and a fraction of all 0s. The sign bit
distinguishes between negative infinity and positive infinity. Being
able to denote infinity as a specific value is useful because it allows
operations to continue past overflow situations. Operations with infinite values are well defined in IEEE floating point.
Not A Number
The value NaN (Not a Number)
is used to represent a value that does not represent a real number.
NaN’s are represented by a bit pattern with an exponent of all 1s and a
non-zero fraction. There are two categories of NaN: QNaN (Quiet NaN) and SNaN (Signalling NaN).
A QNaN is a NaN with the most significant fraction bit set.
QNaN’s propagate freely through most arithmetic operations. These
values pop out of an operation when the result is not mathematically
defined.
An SNaN is a NaN with the most significant fraction bit clear.
It is used to signal an exception when used in operations. SNaN’s can
be handy to assign to uninitialized variables to trap premature usage.
Semantically, QNaN’s denote indeterminate operations, while SNaN’s denote invalid operations.
Special Operations
Operations on special numbers are well-defined by
IEEE. In the simplest case, any operation with a NaN yields a NaN
result. Other operations are as follows:
| Operation | Result |
|---|---|
| n / ±Infinity | 0 |
| ±Infinity x ±Infinity | ±Infinity |
| ±nonzero / 0 | ±Infinity |
| Infinity + Infinity | Infinity |
| ±0 / ±0 | NaN |
| Infinity - Infinity | NaN |
| ±Infinity / ±Infinity | NaN |
| ±Infinity x 0 | NaN |
Summary
To sum up, the following are the corresponding values for a given representation:
| Sign | Exponent (e) | Fraction (f) | Value |
|---|---|---|---|
| 0 | 00..00 | 00..00 | +0 |
| 0 | 00..00 | 00..01 : 11..11 |
Positive Denormalized Real 0.f x 2(-b+1) |
| 0 | 00..01 : 11..10 |
XX..XX | Positive Normalized Real 1.f x 2(e-b) |
| 0 | 11..11 | 00..00 | +Infinity |
| 0 | 11..11 | 00..01 : 01..11 |
SNaN |
| 0 | 11..11 | 10..00 : 11..11 |
QNaN |
| 1 | 00..00 | 00..00 | -0 |
| 1 | 00..00 | 00..01 : 11..11 |
Negative Denormalized Real -0.f x 2(-b+1) |
| 1 | 00..01 : 11..10 |
XX..XX | Negative Normalized Real -1.f x 2(e-b) |
| 1 | 11..11 | 00..00 | -Infinity |
| 1 | 11..11 | 00..01 : 01..11 |
SNaN |
| 1 | 11..11 | 10..00 : 11.11 |
QNaN |
References
A lot of this stuff was observed from small programs I wrote to go back and forth between hex and floating point (printf-style), and to examine the results of various operations. The bulk of this material, however, was lifted from Stallings’ book.
- Computer Organization and Architecture, William Stallings, pp. 222-234 Macmillan Publishing Company, ISBN 0-02-415480-6
- IEEE Computer Society (1985), IEEE Standard for Binary Floating-Point Arithmetic, IEEE Std 754-1985.
- Intel Architecture Software Developer’s Manual, Volume 1: Basic Architecture , (a PDF document downloaded from intel.com.)
- Comparing floating point numbers, Bruce Dawson, http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm.
This is an excellent article on the traps, pitfalls and solutions for
comparing floating point numbers. Hint — epsilon comparison is usually
the wrong solution.
MAK VR-Link
MAK VR-Link 3.91 (虚拟战场仿真):
MAK VR-Link 3.91
利用MAK公司的VR-Link网络工具包.你可以很容易地快速地利用美国国防部(DoD)的 DISDistributed Interactive Simulation)协议或新的HLA(High Level Architecture),通过网络将仿真与虚拟现实应用结合起来, VR-Link的功能强大的、容易使用的程序员界面,通过专家的技术支持.能减少风险、经费及缩短开发周期,并适用于维护现存的或开发新一代的仿真软件。
VR-Link的 PDU(Protocol Data Unit)界面层提供给程序员灵活性.以检验并设置输人和输出DIS PDU。功能强大的交互作用层执行高水平的DIS功能,其包括航迹推算法、界限的设定、碰撞管理以及坐标值得转换,并提供了典型的应用的源代码,这使集成过程变得容易。
VR-Link的面向对象的 C++编程环境提供给程序员极大的灵活性,以超出缺省的功能并将其扩展到新的应用。VR-Link的 C++界面对 C语言应用来说极为易使用.也同时提供了完整的Ada语言界面。
适用的平台:
Silicon Graphics、Windows NT and 95、Sun、Dec、Alpha、Hp、Concurrent
PDU界面层:
适用于所有 DIS PDU的C结构及 C++类对象·从多种形态的 PDU类中提取
·提供辅助函数设置并检查每一个域
·消息头的自动填充
·直观地处理可变长度的PDU
·提供打印 ASCII表示的函数
连接实体的演练
·用于DIS演练的应用接口
·接收和发送 PDU
·管理实体和事件的ID
·将发出的PDU做上时间的标己
·用回调机构发送收到的PDU到用户代码或
VR-Link交互作用层实体
·支持多重发射
交互作用层
远程实体表
·保持对远程实体的跟踪
·航迹的推算(Performs dead reckoning)
·平滑远程车辆的运动
·允许用户构造过滤器
·启动接收实体状态PDU
·提供可配置的超时参数
·跟踪绞接和附着的部件的轨这
·当实体进人或离开演练现场已通知应用
演练地点的实体
·用户自己确定的范围
·在需要的时候自动发送实体状态PDU
·跟踪绞接和触及到的部件
碰撞处理程序
·提供缺省的基于检测算法的包络面
·允许用户提供高保真的碰撞撞测算法
·当检测到碰撞时自动发送碰撞PDU
·对相关的接收到的碰撞PDU自动做出反应
其它的交互作用层功能
·发送焰火和爆炸PDU
·对数据查询做出反应并设置数据PDU
·支持仿真管理
工具
·丰富的矢量和矩阵操作函数
·独立于平台的系统时钟接口
·对不连续的仿真时间的支持
·坐标转换:DIS地心坐标、测地坐标(纬度
/经度/高度)、统一横轴墨卡托(UTM)
投影坐标、地形坐标
其它特色
用户的可扩展性
·易于附加用户新定义的 PDU
·通过再细分类扩展缺省的函数性
典型应用
·NetdumP:一个用于以易读的格式打印
正在接收的 PDU的工具
·F18:一个用于灵活的调试、演示VR-Link大部
分功能的简单的 DIS实体仿真器
·SM and GCF:用 VR-Link的仿真管理支持的简单的例子

