[Bug ada/10932] New: Floating point bug

aigolovin@hotbox.ru gcc-bugzilla@gcc.gnu.org
Thu May 22 14:06:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Floating point bug
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P2
         Component: ada
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: aigolovin@hotbox.ru
                CC: gcc-bugs@gcc.gnu.org
  GCC host triplet: Intel x86, Linux Mandrake 9.1

This is bug 3973 from Mandrake Bugzilla.
I found that having x of type digits 16 and using
ada.numerics.generic_elementary_functions sin(x) always equal 0. The same with
cosine and maybe others. I've tryed to use ada.numerics.aux instead. The problem
remained. Then I've tryed to rewrite assembler code (I was doing that before to
make functions faster). Aux library became operational, however a-ngelfu still
doesn't work for 32- or 64-bit numbers (works only for 80-bit precision). It
seams that the problem is in modification of variable when
converting it's value to subtype, such code used to convert result from
ada.numerics.aux.double type. I can send my modifyed a-numaux.adb (sin and cos
are in assembler, some perfomance gain), fill free to contact me.
Simple program illustrating the problem:

with Text_IO; use Text_IO;
with ada.numerics.generic_elementary_functions;
procedure test is
 type double is digits 16;
 package elfun is new ada.numerics.generic_elementary_functions(double);use elfun;
 package real_io is new float_io(double);
 use real_io;
 n : constant integer := 10;
 pi : constant double := 3.1415962;
 a, sa, ca : double;
 subtype single is double digits 5;
 ee : single;
 begin
  for i in 0..n loop
    a := double(i)*pi/double(n); put(a); put("   ");
    sa := sin(a); ca := cos(a); ee := single(a);
    put(a);put("   ");put(sa);put("   ");put(ca);put("   "); put(double(ee));
    new_line;
  end loop;
 end test;



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the Gcc-bugs mailing list