From 88d5c3e780c98edaec2c8fd48e703bda3cfbe9e7 Mon Sep 17 00:00:00 2001 From: Sun Serega Date: Tue, 5 Dec 2023 12:10:48 +0200 Subject: [PATCH] `RealRange.Size` --- TestSuite/RangeT count.pas | 2 +- bin/Lib/PABCSystem.pas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TestSuite/RangeT count.pas b/TestSuite/RangeT count.pas index a21a634e7..79280ce8d 100644 --- a/TestSuite/RangeT count.pas +++ b/TestSuite/RangeT count.pas @@ -7,4 +7,4 @@ Assert( ('b'..'c').Count = 2 ); Assert( ('c'..'b').Count = 0 ); Assert( (2.0..3).Size = 1 ); -Assert( (3.0..2).Size = -1 ); \ No newline at end of file +Assert( (3.0..2).Size = 0 ); \ No newline at end of file diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 1d094b308..429ceadf7 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -769,7 +769,7 @@ type property Low: real read l; property High: real read h; - property Size: real read h-l; + property Size: real read System.Math.Max(0, h-l); static function operator in(x: real; r: RealRange): boolean := (x >= r.l) and (x <= r.h);