aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/nan_max.adb
blob: a2cac30f5e89f0a1698b19d6c747d5e63ec76006 (plain)
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
-- { dg-do run }

procedure Nan_Max is

   function NaN return Long_Float is
      Zero : Long_Float := 0.0;
   begin
      return Zero / Zero;
   end;

   Z : Long_Float := 1.0;
   N : Long_Float := NaN;

begin
   if Long_Float'Max (N, Z) /= Z then
      raise Program_Error;
   end if;

   if Long_Float'Max (Z, N) /= Z then
      raise Program_Error;
   end if;

   if Long_Float'Max (NaN, Z) /= Z then
      raise Program_Error;
   end if;

   if Long_Float'Max (Z, NaN) /= Z then
      raise Program_Error;
   end if;
end;