File: 18-qgammainc.a68

package info (click to toggle)
algol68g 3.1.2-1.2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,684 kB
  • sloc: ansic: 64,006; sh: 4,169; makefile: 192
file content (45 lines) | stat: -rw-r--r-- 1,134 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
COMMENT

This program is part of the Algol 68 Genie test set.

A small selection of the Algol 68 Genie regression test set is distributed 
with Algol 68 Genie. The purpose of those programs is to perform some checks 
to judge whether A68G behaves as expected.
None of these programs should end ungraciously with for instance an 
addressing fault.

COMMENT

PR quiet regression PR

PR quiet regression PR

PR need mpfr PR

MODE NUM = LONG LONG REAL;

REAL f, g, max dev := 0;

(f := 1e-1, g := 1e-1);
FOR k TO 1000
DO NUM s = f + next random * g, x = f + next random * g;
   NUM a68g = qgammainc(s, x), mpfr = mpfr qgammainc(s, x);
   # print ((a68g, blank, mpfr, newline)); #
   IF REAL dev = SHORTEN SHORTEN ((a68g - mpfr) / mpfr);
      dev > max dev
   THEN max dev := dev
   FI
OD;

(f := 1e-1, g := 1e3);
TO 1000
DO NUM s = f + next random * g, x = f + next random * g;
   NUM a68g = qgammainc(s, x), mpfr = mpfr qgammainc(s, x);
   # print ((a68g, blank, mpfr, newline)); #
   IF REAL dev = SHORTEN SHORTEN ((a68g - mpfr) / mpfr);
      dev > max dev
   THEN max dev := dev
   FI
OD;

print (("max dev = ", max dev, new line));