From bb6cc4325012064bb2fb22ee7d102b0aa5415040 Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Thu, 22 Jan 2026 13:23:35 +0300 Subject: [PATCH 1/2] =?UTF-8?q?SPython=20=D1=81=D1=82=D0=B0=D0=BD=D0=B4?= =?UTF-8?q?=D0=B0=D1=80=D1=82=D0=BD=D0=B0=D1=8F=20=D0=B1=D0=B8=D0=B1=D0=BB?= =?UTF-8?q?=D0=B8=D0=BE=D1=82=D0=B5=D0=BA=D0=B0=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=20=D1=87=D1=83=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/Lib/PABCSystem.pas | 2 +- bin/Lib/SPython/SPythonSystem.pas | 32 +++++++++++++++++++++++++--- bin/Lib/SPython/SPythonSystemPys.pys | 5 ++++- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 66c05b319..4ec9c9947 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -1777,7 +1777,7 @@ function Sign(x: real): integer; ///-- function Sign(x: BigInteger): integer; ///-function Abs(x: число): число; -/// Возвращает модуль числа x +/// Возвращает модуль числа function Abs(x: shortint): shortint; ///-- function Abs(x: smallint): smallint; diff --git a/bin/Lib/SPython/SPythonSystem.pas b/bin/Lib/SPython/SPythonSystem.pas index 91e4bf471..7728fe747 100644 --- a/bin/Lib/SPython/SPythonSystem.pas +++ b/bin/Lib/SPython/SPythonSystem.pas @@ -91,12 +91,25 @@ function !format(val: real; fmt: string): string; //function any(seq: sequence of T): boolean; -// Standard Math functions +//------------------------------------ +// Standard Math functions +//------------------------------------ +/// Возвращает абсолютное значение числа function abs(x: integer): integer; - +/// Возвращает абсолютное значение числа function abs(x: real): real; +/// Возвращает результат и остаток от целочисленного деления +function divmod(a,b: integer): (integer,integer); + +/// Возвращает x в степени y +function pow(x,y: real): real; +/// Возвращает x в целой степени n +function pow(x: real; n: integer): real; +/// Возвращает x в целой степени n +function pow(x: BigInteger; n: integer): BigInteger; + // function floor(x: real): real; type list = class(IEnumerable) @@ -651,10 +664,23 @@ end; //function any(seq: sequence of T): boolean := seq.Any(x -> x); -function abs(x: integer): integer := if x >= 0 then x else -x; +//------------------------------------ +// Standard Math functions +//------------------------------------ +function abs(x: integer): integer := if x >= 0 then x else -x; function abs(x: real): real := PABCSystem.Abs(x); +function divmod(a,b: integer): (integer,integer) + := (a div b, a mod b); +// divmod вещественный аналог надо реализовать на питоне бы + +function pow(x,y: real): real := PABCSystem.Power(x,y); + +function pow(x: real; n: integer): real := PABCSystem.Power(x,n); + +function pow(x: BigInteger; n: integer): BigInteger := PABCSystem.Power(x,n); + function len(lst: list): integer := lst.!count; function len(st: &set): integer := st.!count; function len(dct: dict): integer := dct.!count; diff --git a/bin/Lib/SPython/SPythonSystemPys.pys b/bin/Lib/SPython/SPythonSystemPys.pys index 7211115f9..22c0d134d 100644 --- a/bin/Lib/SPython/SPythonSystemPys.pys +++ b/bin/Lib/SPython/SPythonSystemPys.pys @@ -15,4 +15,7 @@ def print(*args: obj, **kwargs: str): if len(args) != 0: pas_print(args[len(args) - 1]) - pas_print(end) \ No newline at end of file + pas_print(end) + +#def divmod(a: int, b: int) -> (int,int) +# := (a // b, a % b); From e8ed35095a3aec77ed83db180e48a5df96d344d8 Mon Sep 17 00:00:00 2001 From: Sun Serega Date: Tue, 27 Jan 2026 18:55:23 +0100 Subject: [PATCH 2/2] fix ArrFill in help (#3382) --- PABCNetHelp/LangGuide/Types/dynamicarrays.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PABCNetHelp/LangGuide/Types/dynamicarrays.html b/PABCNetHelp/LangGuide/Types/dynamicarrays.html index 6a9fefceb..7e54b1d67 100644 --- a/PABCNetHelp/LangGuide/Types/dynamicarrays.html +++ b/PABCNetHelp/LangGuide/Types/dynamicarrays.html @@ -96,7 +96,7 @@

var a := Arr(1,3,5,7,8);                   // array of integer
var s := Arr('Иванов','Петров','Сидоров'); // array of string
var - b := ArrFill(777,5);                   + b := ArrFill(5,777);                   // b = [777,777,777,777,777]
var r := ArrRandom(10);                    // заполнение 10 случайными целыми в диапазоне от 0 до 100