Browse Source

+ start of a float128 unit, was still lying around, so it won't get lost

git-svn-id: trunk@9031 -
florian 18 years ago
parent
commit
3afb948ca4
3 changed files with 98 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 70 0
      rtl/inc/float128.pp
  3. 27 0
      rtl/inc/softfpu.pp

+ 1 - 0
.gitattributes

@@ -4665,6 +4665,7 @@ rtl/inc/except.inc svneol=native#text/plain
 rtl/inc/fexpand.inc svneol=native#text/plain
 rtl/inc/fexpand.inc svneol=native#text/plain
 rtl/inc/file.inc svneol=native#text/plain
 rtl/inc/file.inc svneol=native#text/plain
 rtl/inc/filerec.inc svneol=native#text/plain
 rtl/inc/filerec.inc svneol=native#text/plain
+rtl/inc/float128.pp svneol=native#text/plain
 rtl/inc/generic.inc svneol=native#text/plain
 rtl/inc/generic.inc svneol=native#text/plain
 rtl/inc/genmath.inc svneol=native#text/plain
 rtl/inc/genmath.inc svneol=native#text/plain
 rtl/inc/genset.inc svneol=native#text/plain
 rtl/inc/genset.inc svneol=native#text/plain

+ 70 - 0
rtl/inc/float128.pp

@@ -0,0 +1,70 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by the FPC development time
+
+    Implements overloaded operators and misc. functions to
+    provide a float128 type
+
+    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.
+
+ **********************************************************************}
+unit float128;
+
+  interface
+
+    uses
+      softfpu;
+
+    operator+ (const f1,f2 : float128) result : float128;inline;
+    operator* (const f1,f2 : float128) result : float128;inline;
+    operator- (const f1,f2 : float128) result : float128;inline;
+    operator/ (const f1,f2 : float128) result : float128;inline;
+
+    operator :=(const source : double) dest : float128;inline;
+
+    operator :=(const source : float128) dest : double;inline;
+
+
+  implementation
+
+    operator+ (const f1,f2 : float128) result : float128;inline;
+      begin
+        result:=float128_add(f1,f2);
+      end;
+
+
+    operator* (const f1,f2 : float128) result : float128;inline;
+      begin
+        result:=float128_mul(f1,f2);
+      end;
+
+
+    operator- (const f1,f2 : float128) result : float128;inline;
+      begin
+        result:=float128_sub(f1,f2);
+      end;
+
+
+    operator/ (const f1,f2 : float128) result : float128;inline;
+      begin
+        result:=float128_div(f1,f2);
+      end;
+
+
+    operator :=(const source : double) dest : float128;inline;
+      begin
+        dest:=float64_to_float128(source);
+      end;
+
+
+    operator :=(const source : float128) dest : double;inline;
+      begin
+        dest:=float128_to_float64(source);
+      end;
+
+end.

+ 27 - 0
rtl/inc/softfpu.pp

@@ -427,6 +427,33 @@ Function int64_to_float64( a: int64 ): float64; compilerproc;
 Function int64_to_float32( a: int64 ): float32rec; compilerproc;
 Function int64_to_float32( a: int64 ): float32rec; compilerproc;
 
 
 
 
+{$ifdef FPC_SOFTFLOAT_FLOAT128}
+function float128_is_nan( a : float128): flag;
+function float128_is_signaling_nan( a : float128): flag;
+function float128_to_int32(a: float128): int32;
+function float128_to_int32_round_to_zero(a: float128): int32;
+function float128_to_int64(a: float128): int64;
+function float128_to_int64_round_to_zero(a: float128): int64;
+function float128_to_float32(a: float128): float32;
+function float128_to_float64(a: float128): float64;
+{$ifdef FPC_SOFTFLOAT_FLOAT80}
+function float128_to_floatx80(a: float128): floatx80;
+{$endif FPC_SOFTFLOAT_FLOAT80}
+function float128_round_to_int(a: float128): float128;
+function float128_add(a: float128; b: float128): float128;
+function float128_sub(a: float128; b: float128): float128;
+function float128_mul(a: float128; b: float128): float128;
+function float128_div(a: float128; b: float128): float128;
+function float128_rem(a: float128; b: float128): float128;
+function float128_sqrt(a: float128): float128;
+function float128_eq(a: float128; b: float128): flag;
+function float128_le(a: float128; b: float128): flag;
+function float128_lt(a: float128; b: float128): flag;
+function float128_eq_signaling(a: float128; b: float128): flag;
+function float128_le_quiet(a: float128; b: float128): flag;
+function float128_lt_quiet(a: float128; b: float128): flag;
+{$endif FPC_SOFTFLOAT_FLOAT128}
+
 CONST
 CONST
 {-------------------------------------------------------------------------------
 {-------------------------------------------------------------------------------
 Software IEC/IEEE floating-point underflow tininess-detection mode.
 Software IEC/IEEE floating-point underflow tininess-detection mode.