全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1154 2
2012-06-29
Example is
data test;
a=1/9;
run;
proc print data = test;
var a;
format a 19.16;
run;

However, the result shows 0.1111111111111100, rather than 0.1111111111111111 as I expected.

Please give me your warm hands to figure this out.
Thanks
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-6-29 07:11:48
Total it is 64 bits for a 8 byte number (SAS default)

    Sign bit: 1 bit
    Exponent width: 11 bits
    Significand precision: 53 bits (52 explicitly stored)



That is how precision digits it can go.

data _null_;
do i= 50 to 55;
  x=2**(-i);
  put i= x= 19.16;
  end;
run;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-6-29 08:44:24
Thanks. Your code is to generate the new data with 16 decimal. My purpose is to input and display the existing data with 16 decimal. Please let me know how to do.

e.g.
data test;
input a 19.16;
cards;
0.11111111111113112
;
run;
proc print data = test;
var a;
format a 19.16;
run;

The results is still
Obs a
1 0.1111111111111300, not 0.11111111111113112

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群