The float can be converted to well known single-precision IEEE 754 number, why 754? It's the standard representation of single-precision numbers, used in net transmission.

Compares to send the float as text or send/receive without re-formatting/un-formatting, it's much faster & safer. 

What confuses me is that nowadays floats are stored just what IEEE 754 says to be. Or maybe windows only?

But the most important thing is, when sending/receiving data/numbers, use standards.

See this page for more info.

I'll explain this format a little. It uses the first bit as a sign representation(1 if negative), the following 8bit as its exponential part, the last 23bit as its fraction part.

See this example:

1 10000001 10110011001100110011010

sign   expo       mantissa

It is divided as stated above.

The Microsoft's floats is following this standard. See the following definition of float in Windows.

Where float uses 8 bits of exponent and 23 bits of mantissa, compares to double's 11 bits of exponent and 52 bits of mantissa.

About the bias refered to in the page above:

QUOTE

Because exponents are stored in an unsigned form, the exponent is biased by half its possible value.For type float, the bias is 127; for type double, it is 1023.You can compute the actual exponent value by subtracting the bias value from the exponent value.

/QUOTE

Note that this exponent's base is not 10, of course it's 2! So 2E127 is approximately 10E38, that's why float's range is about 1E-38~3E38!

Converting between IEEE 754 and Float (Format related的更多相关文章

  1. IEEE 754标准

    IEEE 754-1985 was an industry standard for representing floating-point numbers in computers, officia ...

  2. IEEE二进制浮点数算术标准(IEEE 754)

    整理自IEEE 754 IEEE二进制浮点数算术标准(IEEE 754)是20世纪80年代以来最广泛使用的浮点数运算标准,为许多CPU与浮点运算器所采用.这个标准定义了表示浮点数的格式(包括负零-0) ...

  3. 浮点数在计算机内存中的表示(IEEE 754规定1位是符号位,8位是指数,剩下的23位为有效数字)

    本文转载自:阮一峰的博客,http://www.ruanyifeng.com/blog/2010/06/ieee_floating-point_representation.html 张玉彬的博客 h ...

  4. 【算法】解析IEEE 754 标准

    目录结构: contents structure [-] 浮点数的存储过程 次正规数(Denormalized Number) 零(zero) 非数值(NaN) 无穷大(infinity) 除数为0. ...

  5. 【转】浮点数与IEEE 754

    http://www.cnblogs.com/kingwolfofsky/archive/2011/07/21/2112299.html 浮点数 1.   什么是浮点数 在计算机系统的发展过程中,曾经 ...

  6. IEEE 754浮点数表示标准

    二进制数的科学计数法 C++中使用的浮点数包括采用的是IEEE标准下的浮点数表示方法.我们知道在数学中可以将任何十进制的数写成以10为底的科学计数法的形式,如下 其中显而易见,因为如果a比10大或者比 ...

  7. IEEE 754 浮点数在计算机中的表示方法

    IEEE二进制浮点数算术标准(IEEE 754)是20世纪80年代以来最广泛使用的浮点数运算标准,为许多CPU与浮点运算器所采用.这个标准定义了表示浮点数的格式(包括负零-0)与反常值(denorma ...

  8. 基于 IEEE 754 标准的 单精度浮点数计算方式 (未完成)

    def dec2bin(dec): if dec < 0: s = ' dec = dec * (-1) else: s = ' e = 127 dec = float(dec) r = int ...

  9. 打印一个浮点数组,会输出字符串"Hello, world“ & 浮点数的二进制表示(IEEE 754标准)

    #include <stdio.h> #include<stdlib.h> int main() { float a[3] = { 1143139122437582505939 ...

随机推荐

  1. Java IO 嵌套流、文本的输入输出和存储

    Java IO 嵌套流.文本的输入输出和存储 @author ixenos 1.   组合流过滤器(嵌套流) a)    跨平台文件分割符:常量字符串 java.io.File.seperator 等 ...

  2. ARC 下面可能导致的内存问题

    一.ARC相对MRC来说,减轻了程序员的大部分内存管理工作,使用ARC的时候也需要十分清除内存管理的原理,不然可能带来一些很难调试的问题.下面是ARC下面需要注意的一些问题 1)对象互相引用,形成引用 ...

  3. 判断括号字符串是否为合法+求n对括号的所有组合

    n对括号的有效组合数 参考:https://zh.wikipedia.org/wiki/%E5%8D%A1%E5%A1%94%E5%85%B0%E6%95%B0 import java.util.Ar ...

  4. 什么是JDBC?

    JDBC是Java数据库连接(Java DataBase Connectivity)技术的简称,提供连接各种常用数据库的能力! 1.方式一(配置文件实现): <!-- 1. 连接池实例 --&g ...

  5. app测试--稳定性测试

    稳定性测试的概念有2种, 一, 稳定性测试,对应于异常性测试,即发生异常情况时,系统如何反应的测试.包含: 1 交互性测试,被打扰的情况,如来电,短信,低电量等.这些其实在上章的功能测试中有提到. 2 ...

  6. php 类中设置成员属性方法

    class FileUpload { private $path = "./uploads"; //上传文件保存的路径 private $allowtype = array('jp ...

  7. 嵌套表SHAPE

    SQL语法 SHAPE {<master query>} APPEND ({ <child table query> } RELATE <master column> ...

  8. 第三十七节,hashlib加密模块

    在使用hashlib模块时需要先 import hashlib 引入模块 用于加密相关的操作,代替了md5模块和sha模块,主要提供 SHA1, SHA224, SHA256, SHA384, SHA ...

  9. HDU2206:IP的计算

    Problem Description 在网络课程上,我学到了很多有关IP的知识.IP全称叫网际协议,有时我们又用IP来指代我们的IP网络地址,现在IPV4下用一个32位无符号整数来表示,一般用点分方 ...

  10. android网络编程之HttpUrlConnection的讲解--实现文件的断点上传

    1.网络开发不要忘记在配置文件中添加访问网络的权限 <uses-permission android:name="android.permission.INTERNET"/& ...