On Thu, Apr 4, 2024 at 9:49 PM Martin Frb via fpc-devel
wrote:
> The below writes: -9223372036854775808
>
> Shouldn't absolute return a positive number?
>
> program Project1;
> begin
>writeln( abs(low(int64)) );
> end.
See https://gitlab.com/freepascal.org/fpc/source/-/issues/40694
There we
On 04/04/2024 16:39, J. Gareth Moreton via fpc-devel wrote:
Essentially, an arithmetic overflow is happening. Since the largest
Int64 possible is 9,223,372,036,853,775,807, going one above that (the
result to abs(low(int64))) wraps back around to
-9,223,372,036,853,775,808.
Internally, you c
Essentially, an arithmetic overflow is happening. Since the largest
Int64 possible is 9,223,372,036,853,775,807, going one above that (the
result to abs(low(int64))) wraps back around to -9,223,372,036,853,775,808.
Internally, you can think about negating (positing?) a negative number
as inve
Ahoy, hoy,
On 2024‑04‑04 15:14:38 +0200, Martin Frb via fpc-devel wrote:
> The below writes: -9223372036854775808
>
> Shouldn't absolute return a positive number?
No, see https://wiki.freepascal.org/Integer#characteristics
--
Sincerely yours,
Kai Burghardt
signature.asc
Description: PGP sign
The below writes: -9223372036854775808
Shouldn't absolute return a positive number?
program Project1;
begin
writeln( abs(low(int64)) );
end.
Seems
writeln( abs(low(longint)) );
also returns negative...
___
fpc-devel maillist - fpc-devel@lists