[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#148529: ada/6911: Sin and Cos returns bad result or exception



On Mon, May 12, 2003 at 04:31:18PM -0700, Dara Hazeghi wrote:
> the final note in the Debian bug trail for this bug noted that this  
> problem was fixed on gcc 3.3 branch. Is this the case? Right now,  
> mainline and 3.3 branch produce this for me:
> 
> -7.07105E-01
>  0.00000E+00
> -8.74228E-08
>  1.74846E-07
> -7.07105E-01
> 
> (the second testcase). Can anyone confirm the state of this bug. Thanks,

For:

--- cut ---
with Ada.Text_IO;
use Ada.Text_IO;

with Ada.Numerics;
use Ada.Numerics;
   
with Ada.Numerics.Generic_Elementary_Functions;

with Aux;
use Aux;

procedure TestBug2 is

   type F is new Float;
   subtype Radians is F;

   package Maths is new Generic_Elementary_Functions(F);
   use Maths;

begin
    Ada.Text_IO.Put_Line(Double'Image(Aux.Sin(5.49779)));
    Ada.Text_IO.Put_Line(Double'Image(Aux.Sin(0.0*pi)));
    Ada.Text_IO.Put_Line(Double'Image(Aux.Sin(1.0*pi)));
    Ada.Text_IO.Put_Line(Double'Image(Aux.Sin(2.0*pi)));
    Ada.Text_IO.Put_Line(Double'Image(Aux.Sin(5.49779)));

    Ada.Text_IO.Put_Line(F'Image(Sin(5.49779)));
    Ada.Text_IO.Put_Line(F'Image(Sin(0.0*pi)));
    Ada.Text_IO.Put_Line(F'Image(Sin(1.0*pi)));
    Ada.Text_IO.Put_Line(F'Image(Sin(2.0*pi)));
    Ada.Text_IO.Put_Line(F'Image(Sin(5.49779)));
end TestBug2;
--- cut ---

I get:

--- cut ---
-7.07104761532644598E-01
 0.00000000000000000E+00
-5.42101086242752217E-20
 1.08420217248550443E-19
-7.07104761532644598E-01
-7.07105E-01
 0.00000E+00
-8.74228E-08
 1.74846E-07
-7.07105E-01
--- cut ---

Which looks much better then before,  but I haven't
checked the results against a calculator...

This is the same code that failed before.
-- 
Brian May <bam@snoopy.apana.org.au>



Reply to: