Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gnat.dg / opt18.adb
blob94c44beb6f7fde972f26415bb840b21aa169eeed
1 -- { dg-do compile }
2 -- { dg-options "-O3" }
4 with Opt18_Pkg; use Opt18_Pkg;
6 package body Opt18 is
8 function Mag (Item : in Cart_Vector_Type) return Float is
9 begin
10 return Sqrt (Item (X) * Item (X) + Item (Y) * Item (Y)
11 + Item (Z) * Item (Z));
12 end;
14 function Unit_Quaternion_To_Mag_Axis (Quaternion : in Unit_Quaternion_Type)
15 return Mag_Axis_Type is
16 Sin_Half : Float
17 := Mag (Cart_Vector_Type'(Quaternion.X, Quaternion.Y, Quaternion.Z));
18 begin
19 if Sin_Half > 3.0 * First_Order_Trig then
20 return
21 (Mag => Atan2 (Double_Trig (Unchecked_Trig_Pair (Sin_Half,
22 Quaternion.S))),
23 Axis => Unit_Vector_Type'(Quaternion.X / Sin_Half,
24 Quaternion.Y / Sin_Half,
25 Quaternion.Z / Sin_Half));
26 else
27 return (0.0, X_Unit);
28 end if;
29 end;
31 end Opt18;