From 329191b3600a1a59bd7ed4930274ac86e036745e Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Wed, 15 Oct 2025 12:53:31 +0300 Subject: [PATCH] =?UTF-8?q?CbRt=20-=20=D0=B2=20=D1=81=D1=82=D0=B0=D0=BD?= =?UTF-8?q?=D0=B4=D0=B0=D1=80=D1=82=D0=BD=D0=BE=D0=BC=20=D0=BC=D0=BE=D0=B4?= =?UTF-8?q?=D1=83=D0=BB=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InstallerSamples/WhatsNew/3_11_1/CbRt.pas | 4 ++++ bin/Lib/PABCSystem.pas | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 InstallerSamples/WhatsNew/3_11_1/CbRt.pas diff --git a/InstallerSamples/WhatsNew/3_11_1/CbRt.pas b/InstallerSamples/WhatsNew/3_11_1/CbRt.pas new file mode 100644 index 000000000..662a731d5 --- /dev/null +++ b/InstallerSamples/WhatsNew/3_11_1/CbRt.pas @@ -0,0 +1,4 @@ +begin + // Вычисление кубического корня. Отрицательные числа допускаются + Print(CbRt(-27)); +end. \ No newline at end of file diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 15e880143..01c5cd2f5 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -1829,6 +1829,8 @@ function Log10(x: real): real; function LogN(base, x: real): real; /// Возвращает квадратный корень числа x function Sqrt(x: real): real; +/// Возвращает кубический корень числа x (x может быть < 0) +function Cbrt(x: real): real; ///-function Sqr(x: число): число; /// Возвращает квадрат числа x function Sqr(x: shortint): integer; @@ -9384,6 +9386,8 @@ function LogN(base, x: real) := Math.Log(x) / Math.Log(base); function Sqrt(x: real) := Math.Sqrt(x); +function Cbrt(x: real) := Sign(x) * Power(Abs(x), 1/3); + function Sqr(x: integer): int64 := int64(x) * int64(x); function Sqr(x: shortint): integer := x * x;