Floating point

Waldek Hebisch hebisch at math.uni.wroc.pl
Tue Sep 1 04:58:02 CEST 2020


On Mon, Aug 31, 2020 at 01:07:42PM -0700, scott andrew franco wrote:
> samiam at samiam-home-pc:~/projects/pascal/pascal-p5$ cat test.pas
> program test(output);
>  var b,c: real;
>  begin
>  b := maxint;
>  c := 10.0;
>  b := b+c;
>  writeln(b:40:1);
>  writeln(maxint:38);
>  end.
> samiam at samiam-home-pc:~/projects/pascal/pascal-p5$ gpc -o test test.pas
> samiam at samiam-home-pc:~/projects/pascal/pascal-p5$ ./test
>  9223372036854775808.0
>  9223372036854775807

Note that floating point results are approximate and on
64-bit machines real accuracy is lower than integer
accuracy.

-- 
                              Waldek Hebisch



More information about the Gpc mailing list