Floating point
Waldek Hebisch <[email protected]> Tue, 1 Sep 2020 04:58:02 +0200
| Newsgroups | gmane.comp.compilers.gpc |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Aug 31, 2020 at 01:07:42PM -0700, scott andrew franco wrote:
> samiam@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@samiam-home-pc:~/projects/pascal/pascal-p5$ gpc -o test test.pas
> samiam@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