单精度浮点和python 双精度浮点数有什么区别

君,已阅读到文档的结尾了呢~~
单精度和双精度的区别???8,8,??
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
单精度和双精度的区别
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口单精度浮点数,双精度浮点数 - 开源中国社区
当前访客身份:游客 [
当前位置:
发布于 日 20时,
单精度浮点数,双精度浮点数的存储解析
代码片段(1)
1.&[代码]单精度浮点数&&&&
package javay.
public class DBGFloat {
public static double debugFloat(float result) {
String str = Integer.toBinaryString(Float.floatToIntBits(result));
System.out.print(result +"的");
return debugFloat(str);
public static double debugFloat(String str) {
if (str.length() & 32) {
StringBuffer sb = new StringBuffer();
for (int a = 0; a & 32 - str.length(); a ++) {
sb.append("0");
sb.append(str);
str = sb.toString();
char[] chs = str.toCharArray();
String sign = "";
StringBuffer exponent = new StringBuffer();
StringBuffer fraction = new StringBuffer();
double mantissa = 1.0;
for (int m = 0, n = 0; m & chs. m ++, n ++) {
if (n == 0) {
sign = String.valueOf(chs[m]);
} else if (n & 9) {
exponent.append(chs[m]);
fraction.append(chs[m]);
if (chs[m] == '1') {
mantissa = mantissa + Math.pow(2, 8 - n);
int exp = Integer.valueOf(exponent.toString(), 2) - 127;
int sg = 1;
if (sign.equals("1")) {
if (exp == -127) {
exp = -126;
mantissa = 0.0;
double res = sg * Math.pow(2, exp) *
System.out.println("二进制存储[" + sign + "][" + exponent + "][" + fraction + "]=&" + sg + "×2的" + exp + "次方×" + mantissa + "=" + res);
public static double debugDouble(double result) {
String str = Long.toBinaryString(Double.doubleToLongBits(result));
System.out.print(result +"的");
return debugDouble(str);
public static double debugDouble(String str) {
if (str.length() & 64) {
StringBuffer sb = new StringBuffer();
for (int a = 0; a & 64 - str.length(); a ++) {
sb.append("0");
sb.append(str);
str = sb.toString();
char[] chs = str.toCharArray();
String sign = "";
StringBuffer exponent = new StringBuffer();
StringBuffer fraction = new StringBuffer();
double mantissa = 1.0;
for (int m = 0, n = 0; m & chs. m ++, n ++) {
if (n == 0) {
sign = String.valueOf(chs[m]);
} else if (n & 12) {
exponent.append(chs[m]);
fraction.append(chs[m]);
if (chs[m] == '1') {
mantissa = mantissa + Math.pow(2, 11 - n);
int exp = Integer.valueOf(exponent.toString(), 2) - 1023;
int sg = 1;
if (sign.equals("1")) {
if (exp == -1023) {
exp = -1022;
mantissa = 0.0;
double res = sg * Math.pow(2, exp) *
System.out.println("二进制存储[" + sign + "][" + exponent + "][" + fraction + "]=&" + sg + "×2的" + exp + "次方×" + mantissa + "=" + res);
开源中国-程序员在线工具:
相关的代码(3459)
开源从代码分享开始
壶漏子的其它代码谁来科普一下
整数 浮点 单精度双精度都是什么意思?_显卡吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:2,347,580贴子:
谁来科普一下
整数 浮点 单精度双精度都是什么意思?收藏
2016年的最后一个月,我们还能抓住创业的尾巴~注册属于自己的公司。
随便找一本计算机语言的书你就知道了,再不济还有百度,勿做伸手党
…………我记得当时学C语言…书的第一章讲的就是这个…是基础……
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或}

我要回帖

更多关于 双精度浮点数范围 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信