RoundTo:保留一定的精度

Rounds   a   floating-point   value   to   a   specified   digit   or   power   of   ten   using   揃anker抯   rounding?  
   
  Unit  
   
  Math  
   
  Category  
   
  Arithmetic   routines  
   
  type   TRoundToRange   =   -37..37;  
  function   RoundTo(const   AValue:   Double;   const   ADigit:   TRoundToRange):   Double;  
   
  Description  
   
  Call   RoundTo   to   round   AValue   to   a   specified   power   of   ten.  
   
  AValue   is   the   value   to   round.  
   
  ADigit   indicates   the   power   of   ten   to   which   you   want   AValue   rounded.   It   can   be   any   value   from   ?7   to   37   (inclusive).  
   
  RoundTo   uses   揃anker抯   Rounding?to   determine   how   to   round   values   that   are   exactly   midway   between   the   two   values   that   have   the   desired   number   of   significant   digits.   This   method   rounds   to   an   even   number   in   the   case   that   AValue   is   not   nearer   to   either   value.  
   
  The   following   examples   illustrate   the   use   of   RoundTo:    
   
  Expression Value  
   
  RoundTo(1234567,   3) 1234000  
  RoundTo(1.234,   -2) 1.23  
  RoundTo(1.235,   -2) 1.24  
  RoundTo(1.245,   -2) 1.24  
   
  Note: The   behavior   of   RoundTo   can   be   affected   by   the   Set8087CW   procedure   or   SetRoundMode   function. 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值