Debian Codegraph @

gcc/testsuite/gnat.dg/multfixed.adb

raw
1 -- { dg-do run }
2
3 with Ada.Exceptions; use Ada.Exceptions;
4 with Ada.Strings.Fixed; use Ada.Strings.Fixed;
5
6 procedure Multfixed is
7 Z : constant := 4387648782261400837.0;
8 type F1 is delta 1.0 / Z range 0.0 .. (2.0**63-1.0) / Z
9 with Small => 1.0 / Z;
10 type F2 is delta 1.0 range 0.0 .. (2.0**63-1.0)
11 with Small => 1.0;
12 type D is delta 1.0 digits 18;
13
14 X : F1 := 8914588002054909637.0 / Z;
15 Y : F2 := 9079256848778919936.0;
16 U : D;
17 begin
18 U := D'Round(X * Y);
19 raise Program_Error;
20 exception
21 when Exc : Constraint_Error =>
22 if Count (Exception_Message (Exc), "overflow") = 0 then
23 raise Program_Error;
24 end if;
25 end Multfixed;