DELPHI DOUBLE不解之迷
2020-03-01 21:06
344 查看
procedure TForm1.cmd2Click(Sender: TObject);
var
str1, str2: string;
LValue1: Double;
LValue2: Extended;
LFactor1: Double;
LFactor2: Extended;
begin
LFactor1 := 0.1;
LFactor2 := 0.1;
LValue1 := 0.15;
LValue2 := 0.15;
LValue1 := (LValue1 / LFactor1) + 0.5;
LValue2 := (LValue2 / LFactor2) + 0.5;
LValue1 := Int(LValue1); //为什么Int(2)=1???
LValue2 := Int(LValue2);
LValue1 := LValue1 * LFactor1;
LValue2 := LValue2 * LFactor2;
str1 := FloatToStr(LValue1);
str2 := FloatToStr(LValue2);
ShowMessage(str1 + '|' + str2);
end;
转载于:https://www.cnblogs.com/IDELPHI/p/6098857.html
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- 无缘DELPHI的BUG
- 为什么继续选择DELPHI?
- DELPHI一个对付内存汇漏的办法和技巧
- Delphi DBGrid类控件定位到某一行,并更改为选中状态。
- Delphi.TQuery
- Delphi.TDBGrid
- DelphiXE10.2.3 Firemonkey下窗体的编译异常处理
- DELPHI的多线程分析
- delphi 三层 dataclient 存储图片
- Delphi下Treeview控件基于节点编号的访问
- delphi中父母表示法递归构造treeview(在递归函数之外查询数据库)
- Delphi控制Excel
- Delphi服务程序注册与卸载
- delphi操作word
- Delphi中initialization和finalization
- Delphi与Excel的亲密接触
- delphi 与 Excel数据交换
- delphi-多态(overload,override)与接口(interface)
- delphi获取句柄:获取其他线程的光标句柄[DELPHI]
- 用Delphi压缩Access数据库