CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Delphi >  VCL组件开发及应用

送分题:请问浮点数取整的函数是什么?

楼主bohe(薄荷)2001-02-03 11:26:00 在 Delphi / VCL组件开发及应用 提问

请问浮点数取整的函数是什么?  
  round()只能四舍五入,不能取整, 问题点数:10、回复次数:2Top

1 楼ePing(是谁动了我的CSDN的ID?)回复于 2001-02-03 11:28:00 得分 10

Trunc函数  
   
  var  
        S,   T:   string;  
  begin  
        Str(1.4:2:1,   T);  
        S   :=   T   +   '   Truncs   to   '   +   IntToStr(Trunc(1.4))   +   #13#10;  
        Str(1.5:2:1,   T);  
        S   :=   S   +   T   +   '   Truncs   to   '   +   IntToStr(Trunc(1.5))   +   #13#10;  
        Str(-1.4:2:1,   T);  
        S   :=   S   +   T   +   '   Truncs   to   '   +   IntToStr(Trunc(-1.4))   +   #13#10;  
        Str(-1.5:2:1,   T);  
        S   :=   S   +   T   +   '   Truncs   to   '   +   IntToStr(Trunc(-1.5));  
        MessageDlg(S,   mtInformation,   [mbOk],   0);  
  end;Top

2 楼ePing(是谁动了我的CSDN的ID?)回复于 2001-02-03 11:28:00 得分 0

Truncates   a   real   number   to   an   integer.  
   
  Unit  
   
  System  
   
  Category  
   
  arithmetic   routines  
   
  function   Trunc(X:   Extended):   Int64;  
   
  Description  
   
  The   Trunc   function   truncates   a   real-type   value   to   an   integer-type   value.   X   is   a   real-type   expression.   Trunc   returns   an   Int64   value   that   is   the   value   of   X   rounded   toward   zero.  
   
  If   the   truncated   value   of   X   is   not   within   the   Int64   range,   an   EInvalidOp   exception   is   raised.   Top

相关问题

  • 请问access把浮点字段取整是什么函数?急
  • 送分题:Delphi中取整函数是什么?
  • 菜问题:vb6里面有没有向上取整的函数
  • 取整函数怎么写?
  • 取整函数是什么
  • 向上取整函数?
  • 关于取整函数
  • bcb中的取整函数是什么?
  • DELPHI中取整函数是什么?
  • php中取整函数是什么?

关键词

  • 函数
  • real
  • 取整
  • trunc
  • inttostr
  • truncated
  • a real
  • str
  • int64
  • type

得分解答快速导航

  • 帖主:bohe
  • ePing

相关链接

  • Delphi类图书
  • Delphi类源码下载
  • Delphi控件下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo