OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gnat.dg/] [opt18.adb] - Blame information for rev 696

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 696 jeremybenn
-- { dg-do compile }
2
-- { dg-options "-O3" }
3
 
4
with Opt18_Pkg; use Opt18_Pkg;
5
 
6
package body Opt18 is
7
 
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;
13
 
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;
30
 
31
end Opt18;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.