DELPHI DOUBLE不解之迷
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;
DELPHI DOUBLE不解之迷的更多相关文章
- 转:Delphi 6 实用函数
来自: daocaoren0824, 时间: -- ::, ID: 再给你一份 程序员实用函数 {▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎} {▎ ▎} {▎ 大 ...
- ArcEngine地图窗口指定区域导出指定DPI多格式---delphi/C#实现
delphi/C#实现,其他语言稍微改下就行了.AE的编码各个语言都差不多,这里也没用到某一语言的特性. 函数特点: 1.可以精确导出指定范围的图形要素 2.支持多格式.TIF, .EMF,.GIF, ...
- float和double的精度
作者: jillzhang 联系方式:jillzhang@126.com 原网址:http://blog.csdn.net/wuna66320/article/details/1691734 1 范围 ...
- Delphi、C C++、Visual Basic数据类型的对照 转
Delphi.C C++.Visual Basic数据类型的对照 变量类型 Delphi C/C++ Visual Basic 位有符号整数 ShortInt char -- 位无符号整数 Byte ...
- delphi.指针.PChar
此文是delphi.指针.应用姊妹篇,想细化一下PChar应用,所以有了此文. 注意: 1:此文讲的是PChar与字符串相关操作,其它方法暂不多讲. 2:由于D分开Ansi/Unicode的两种完全不 ...
- Delphi编写DLL供C#调用的实例
Delphi中编写的Dll: library TestDLL; { Important note about DLL memory management: ShareMem must be the f ...
- Delphi 调用Dll的两种方式
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System ...
- Delphi日期函数、日期加减
Delphi里有现成的函数可以实现日期加减,是在DateUtils单元里的. function IncYear(const AValue: TDateTime; const ANumberOfYear ...
- delphi数据类型及占用的字节数 C++ 对应数据类型
delphi byte:1个字节. int/Integer: long: long long:8字节,64位 shortInt:2字节,16位 LongInt:4字节,32位 Int64:8字节,64 ...
随机推荐
- CentOS7中永久保存systemd日志
将systemd的日志写入磁盘: 1.在/var/log/目录下创建日志存放目录,并加入systemd-journal的权限: ~]#mkdir /var/log/journal ~]#chown r ...
- Sql Server关于日期查询时,如果表中日期到具体某个时间
1.如果查询日期参数为'2017/02/21',而数据库表中的字段为'2017/02/21 12:34:16.963',则需要格式化一下日期才能查询出来,如下 select * from table ...
- Effective C++(10) 重载赋值操作符时,返回该对象的引用(retrun *this)
问题聚焦: 这个准则比较简短,但是往往就是这种细节的地方,可以提高你的代码质量. 细节决定成败,让我们一起学习这条重载赋值操作符时需要遵守的准则吧. 还是以一个例子开始: Demo // 连锁赋值 x ...
- Python学习---抽屉框架分析[点赞功能分析]
实际上就是多了一个隐藏的span标签,内容是+1,配合setInterval实现的动态效果 settings.py INSTALLED_APPS = [ ... 'app01', # 注册app ] ...
- phpstrom设置php环境
phpstorm设置自动同步服务器 Tools->Deployment->Confinguration 点+号,添加服务器,类型SFTP,输入name 点击ok,项目与服务器连接成功! 设 ...
- July 27th 2017 Week 30th Thursday
A smile is the most charming part of a person forever. 微笑永远是一个人身上最好看的东西. Smile in the mirror, and yo ...
- December 16th 2016 Week 51st Friday
My life is a straight line, turning only for you. 我的人生是一条直线,转弯只是为了你. My life is a straight line that ...
- pat 5—1 求该日是该年的第几天
哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 前面还是欠了一堆,慢慢补吧. 看了别人的博客才知道前面有一次圆面积的题,我上课是在干啥......... 打是打出来了,但是还是有几个蒙蔽的地方: ...
- 021.4 IO流——字节、字符桥梁(编码解码)
默认使用的就是gbk编码,这里的例子改成了utf8编码 写入—编码 private static void writeText() throws IOException { FileOutputStr ...
- linux(ubuntu)因为代理网页无法访问
当有一天你打开浏览器的时候,页面上显示,未链接到网络,请检查代理服务器,出现了如下图所示的情况: 但是你检查一下了网络,可以ping通,而且在同一个网络下,你的手机平板可以上网,那么你就想一想,昨天i ...