This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/29462] New: Sign ignored on fixed point multiplication


The sign seems to be ignored when multiplying a named number with a fixed point
value.  Converting the named number to a fixed point type seems to work around
the problem.  See the example below:

with Ada.Text_IO;
procedure Test
is
   type T is delta 0.1 range -1.0 .. 1.0;
   X : constant := -1.0;
   Y : T;
   package T_IO is new Ada.Text_IO.Fixed_IO (T);
begin
   Ada.Text_IO.Put ("X = "); T_IO.Put (X); Ada.Text_IO.New_Line;
   Y := -1.0;
   Ada.Text_IO.Put ("Y = "); T_IO.Put (Y); Ada.Text_IO.New_Line;
   Ada.Text_IO.Put ("X * Y = "); T_IO.Put (X * Y); Ada.Text_IO.New_Line;
   Ada.Text_IO.Put ("T (X) * Y = "); T_IO.Put (T (X) * Y);
Ada.Text_IO.New_Line;
end Test;


-- 
           Summary: Sign ignored on fixed point multiplication
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dewi dot daniels at silver-software dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29462


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]