zoukankan      html  css  js  c++  java
  • IEEE浮点标准

      原文地址:http://www.math.byu.edu/~schow/work/IEEEFloatingPoint.htm

    Floating point system

    Floating point arithmetic

      浮点型标准是什么?

      IEEE浮点标准是上世纪80年代初由IEEE采用的一个浮点计算系统。

      计算机采用IEEE浮点标准的要求:

      1.正确计算舍入;

      2.浮点数应该被计算机正确表示;

      3.异常处理应该是明确一致的。

      引用:见顶部

      浮点数表示法

      32位机的单精度数:

      32位机的单精度模式会将一个字表示为b1b2b3...b9b10b11...b32的实数形式

                                      (-1)s x 2e-127 x (1.f)2

       where s = b1,  e = (b2...b9)2, and f = b10b11...b32.  

                                  

    符号位 偏移指数 正常数字尾部的分数
    1 bit 8 bits 23 bits
    s e f

       需要注意的是,尾部的分数部分由一个隐藏位和实际尾部数字共24位二进制数存储。  

      32位的双精度数

      32位机的双精度模式会将两个字表示为b1b2b3...b12b13b14...b64 的实数形式

                                       (-1)s x 2e-1023 x (1.f)2

      where s = b1,  e = (b2...b12)2, and f = b13b14...b64

    符号位 偏移指数 尾部的小数
    1 bit 11 bits 52 bits
    s e f

      尾部的分数部分由一个隐藏位和实际尾部数字共53位二进制数存储。

      

      32位机浮点数的十进制值:

      单精度 双精度
    Machine epsilon 2-23 or 1.192 x 10-7   2-52 or 2.220 x 10-16
    最小正数 2-126 or 1.175 x 10-38  2-1022 or 2.225 x 10-308 
    最大正数 (2- 2-23) 2127 or 3.403 x 1038  (2- 2-52) 21023 or 1.798 x 10308 
    最小负数 2-150 or 7.0 x 10-46 2-1075 or 2.5 x 10-324
    十进制精度 6 位标识 15 位标识

            (Machine epsilon:大于1的机器所能表示的最小浮点数;Smallest subnormal:低于最小值?无穷小?)    

            (In computer science, denormal numbers or denormalized numbers (now often called subnormal numbers) fill the underflow gap around zero in floating-point arithmetic. Any non-zero number with magnitude smaller than the smallest normal number is 'subnormal'.)

      IEEE标准舍入

      通常使用舍入到最近值的方式。基本上,给定一个实数x,它正确的舍入值是最接近x的浮点数fl(x)

      

      IEEE浮点标准的特殊值

      单精度表示

      标志位 指数偏移 小数部分
     

    1 bit

    8 bits

    23 bits

    7/4 0 0 1 1 1 1 1 1 1  1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    -34.432175 1 1 0 0 0 0 1 0 0  0 0 0 1 0 0 1 1 0 1 1 1 0 1 0 1 0 0 0 1 1 0 0
    -959818 1 0 0 1 0 0 1 0   1 1 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 0
    + 0 0 0 0 0 0 0 0 0 0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    - 0 1 0 0 0 0 0 0 0 0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    macheps 0 0 1 1 0 1 0 0 0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    "smallest" 0 0 0 0 0 0 0 0 1  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    "largest" 0 1 1 1 1 1 1 1 0  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
    infinity 0 1 1 1 1 1 1 1 1  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
    NaN 0 1 1 1 1 1 1 1 1 Not all 0s or 1s
    2-128** 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

        (macheps = machine epsilon,infinity:无穷大)

      **这些是非标准数。这些数计算机可以表示,但是相比于正常值,它们的精度要低一些。

  • 相关阅读:
    jsp mysql 配置线程池
    服务端 模拟 检测 攻击。。乱写
    硕思闪客精灵 7.2 破解版
    unity UnityAwe 插件
    smartfoxserver 2x 解决 Math NAN
    unity 断点下载
    java 监听文件目录修改
    wind7 64 setup appjs
    sfs2x 修改jvm 内存
    unity ngui 解决图层问题
  • 原文地址:https://www.cnblogs.com/saaav/p/4116216.html
Copyright © 2011-2022 走看看