summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 293e2f9)
raw | patch | inline | side by side (parent: 293e2f9)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 16 Sep 2017 15:10:00 +0000 (18:10 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 16 Sep 2017 15:10:00 +0000 (18:10 +0300) |
rtl/Reals.obn | patch | blob | history |
diff --git a/rtl/Reals.obn b/rtl/Reals.obn
index 4c9f665ab1a868ad4a3f88538bf125c2f673aa77..9efd5a2941c8b436887ad21076c4effabfad6617 100644 (file)
--- a/rtl/Reals.obn
+++ b/rtl/Reals.obn
-MODULE Reals; (* interface based on Oberon V4 *)\r\r IMPORT SYSTEM, CPStrings, CPMath;\r\r PROCEDURE Expo*(x: REAL): INTEGER;\r BEGIN\r RETURN SHORT(CPMath.Exponent(x));\r END Expo;\r\r PROCEDURE ExpoL*(x: LONGREAL): INTEGER;\r BEGIN\r RETURN SHORT(CPMath.Exponent(x));\r END ExpoL;\r\r PROCEDURE SetExpo*(e: INTEGER; VAR x: REAL);\r BEGIN\r x := SHORT(CPMath.Real(CPMath.Mantissa(x), e));\r END SetExpo;\r\r PROCEDURE SetExpoL*(e: INTEGER; VAR x: LONGREAL);\r BEGIN\r x := CPMath.Real(CPMath.Mantissa(x), e);\r END SetExpoL;\r\r PROCEDURE Ten*(e: INTEGER): REAL;\r BEGIN\r RETURN SHORT(CPMath.IntPower(10, e));\r END Ten;\r\r PROCEDURE TenL*(e: INTEGER): LONGREAL;\r BEGIN\r RETURN CPMath.IntPower(10, e);\r END TenL;\r\r PROCEDURE Convert*(x: REAL; n: INTEGER; VAR d: ARRAY OF CHAR);\r BEGIN\r CPStrings.RealToStringForm(x, n, 0, 3, "0", d);\r END Convert;\r\r PROCEDURE ConvertL*(x: LONGREAL; n: INTEGER; VAR d: ARRAY OF CHAR);\r BEGIN\r CPStrings.RealToStringForm(x, n, 0, 3, "0", d);\r END ConvertL;\r\r PROCEDURE ConvertH*(x: REAL; VAR d: ARRAY OF CHAR);\r BEGIN\r CPStrings.IntToStringForm(SYSTEM.VAL(LONGINT, x), CPStrings.hexadecimal, 0, "0", FALSE, d);\r END ConvertH;\r\r PROCEDURE ConvertHL*(x: LONGREAL; VAR d: ARRAY OF CHAR);\r BEGIN\r CPStrings.IntToStringForm(SYSTEM.VAL(HUGEINT, x), CPStrings.hexadecimal, 0, "0", FALSE, d);\r END ConvertHL;\r\rEND Reals.\r
\ No newline at end of file
+MODULE Reals; (* interface based on Oberon V4 *)
+
+ IMPORT SYSTEM, CPStrings, CPMath;
+
+ PROCEDURE Expo*(x: REAL): INTEGER;
+ BEGIN
+ RETURN SHORT(CPMath.Exponent(x));
+ END Expo;
+
+ PROCEDURE ExpoL*(x: LONGREAL): INTEGER;
+ BEGIN
+ RETURN SHORT(CPMath.Exponent(x));
+ END ExpoL;
+
+ PROCEDURE SetExpo*(e: INTEGER; VAR x: REAL);
+ BEGIN
+ x := SHORT(CPMath.Real(CPMath.Mantissa(x), e));
+ END SetExpo;
+
+ PROCEDURE SetExpoL*(e: INTEGER; VAR x: LONGREAL);
+ BEGIN
+ x := CPMath.Real(CPMath.Mantissa(x), e);
+ END SetExpoL;
+
+ PROCEDURE Ten*(e: INTEGER): REAL;
+ BEGIN
+ RETURN SHORT(CPMath.IntPower(10, e));
+ END Ten;
+
+ PROCEDURE TenL*(e: INTEGER): LONGREAL;
+ BEGIN
+ RETURN CPMath.IntPower(10, e);
+ END TenL;
+
+ PROCEDURE Convert*(x: REAL; n: INTEGER; VAR d: ARRAY OF CHAR);
+ BEGIN
+ CPStrings.RealToStringForm(x, n, 0, 3, "0", d);
+ END Convert;
+
+ PROCEDURE ConvertL*(x: LONGREAL; n: INTEGER; VAR d: ARRAY OF CHAR);
+ BEGIN
+ CPStrings.RealToStringForm(x, n, 0, 3, "0", d);
+ END ConvertL;
+
+ PROCEDURE ConvertH*(x: REAL; VAR d: ARRAY OF CHAR);
+ BEGIN
+ CPStrings.IntToStringForm(SYSTEM.VAL(LONGINT, x), CPStrings.hexadecimal, 0, "0", FALSE, d);
+ END ConvertH;
+
+ PROCEDURE ConvertHL*(x: LONGREAL; VAR d: ARRAY OF CHAR);
+ BEGIN
+ CPStrings.IntToStringForm(SYSTEM.VAL(HUGEINT, x), CPStrings.hexadecimal, 0, "0", FALSE, d);
+ END ConvertHL;
+
+END Reals.