楼主: ariman911
2571 3

[问答] R的round問題 [推广有奖]

  • 0关注
  • 0粉丝

硕士生

21%

还不是VIP/贵宾

-

威望
0
论坛币
29500 个
通用积分
0.8507
学术水平
27 点
热心指数
28 点
信用等级
27 点
经验
1815 点
帖子
98
精华
0
在线时间
194 小时
注册时间
2009-11-4
最后登录
2024-10-4

楼主
ariman911 发表于 2013-4-23 06:17:11 |AI写论文
100论坛币
> round(1.12345,digits=4)
[1] 1.1235
> round(0.12345,digits=4)
[1] 0.1234

Why?

這是唯一的特例,還是冰山一角?

最佳答案

dxystata 查看完整内容

Note that for rounding off a 5, the IEC 60559 standard is expected to be used, ‘go to the even digit’. Therefore round(0.5) is 0 and round(-1.5) is -2. However, this is dependent on OS services and on representation error (since e.g. 0.15 is not represented exactly, the rounding rule applies to the represented number and not to the printed number, and so round(0.15, 1) could be either 0.1 or 0.2 ...
关键词:ROUND und 冰山一角 Dig its 冰山一角

沙发
dxystata 发表于 2013-4-23 06:17:12
Note that for rounding off a 5, the IEC 60559 standard is expected to be used, ‘go to the even digit’. Therefore round(0.5) is 0 and round(-1.5) is -2. However, this is dependent on OS services and on representation error (since e.g. 0.15 is not represented exactly, the rounding rule applies to the represented number and not to the printed number, and so round(0.15, 1) could be either 0.1 or 0.2).

已有 1 人评分学术水平 热心指数 信用等级 收起 理由
ariman911 + 1 + 1 + 1 观点有启发

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

藤椅
769274630 发表于 2013-4-23 08:39:35
了不起

板凳
chc0910 发表于 2013-4-23 09:35:25
路过

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 03:09