소스 검색

* add missing gencurr.inc belonging to revision 10422

git-svn-id: trunk@10438 -
micha 17 년 전
부모
커밋
3a8284b524
2개의 변경된 파일65개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      .gitattributes
  2. 64 0
      rtl/inc/gencurr.inc

+ 1 - 0
.gitattributes

@@ -4985,6 +4985,7 @@ rtl/inc/exeinfo.pp svneol=native#text/plain
 rtl/inc/fexpand.inc svneol=native#text/plain
 rtl/inc/file.inc svneol=native#text/plain
 rtl/inc/filerec.inc svneol=native#text/plain
+rtl/inc/gencurr.inc svneol=native#text/plain
 rtl/inc/generic.inc svneol=native#text/plain
 rtl/inc/genmath.inc svneol=native#text/plain
 rtl/inc/genset.inc svneol=native#text/plain

+ 64 - 0
rtl/inc/gencurr.inc

@@ -0,0 +1,64 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2007 by Several contributors
+
+    Generic mathematical routines (on type currency)
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+}
+
+{$ifdef FPC_CURRENCY_IS_INT64}
+
+    function trunc(c : currency) : int64;
+      type
+        tmyrec = record
+          i: int64;
+        end;
+      begin
+        result := int64(tmyrec(c)) div 10000
+      end;
+
+
+    function trunc(c : comp) : int64;
+      begin
+        result := c
+      end;
+
+
+    function round(c : currency) : int64;
+      type
+        tmyrec = record
+          i: int64;
+        end;
+      var
+        rem, absrem: longint;
+      begin
+        { (int64(tmyrec(c))(+/-)5000) div 10000 can overflow }
+        result := int64(tmyrec(c)) div 10000;
+        rem := int64(tmyrec(c)) - result * 10000;
+        absrem := abs(rem);
+        if (absrem > 5000) or
+           ((absrem = 5000) and
+            (rem > 0)) then
+          if (rem > 0) then
+            inc(result)
+          else
+            dec(result);
+      end;
+
+
+    function round(c : comp) : int64;
+      begin
+        result := c
+      end;
+
+{$endif FPC_CURRENCY_IS_INT64}
+
+
+
+