-- CXA5A07.A
|
-- CXA5A07.A
|
--
|
--
|
-- Grant of Unlimited Rights
|
-- Grant of Unlimited Rights
|
--
|
--
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- unlimited rights in the software and documentation contained herein.
|
-- unlimited rights in the software and documentation contained herein.
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- this public release, the Government intends to confer upon all
|
-- this public release, the Government intends to confer upon all
|
-- recipients unlimited rights equal to those held by the Government.
|
-- recipients unlimited rights equal to those held by the Government.
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- released technical data and computer software in whole or in part, in
|
-- released technical data and computer software in whole or in part, in
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- to do so.
|
-- to do so.
|
--
|
--
|
-- DISCLAIMER
|
-- DISCLAIMER
|
--
|
--
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
--*
|
--*
|
--
|
--
|
-- OBJECTIVE:
|
-- OBJECTIVE:
|
-- Check that the function Arctan provides correct results.
|
-- Check that the function Arctan provides correct results.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- This test examines both the version of Arctan resulting from the
|
-- This test examines both the version of Arctan resulting from the
|
-- instantiation of the Ada.Numerics.Generic_Elementary_Functions with
|
-- instantiation of the Ada.Numerics.Generic_Elementary_Functions with
|
-- a type derived from type Float, as well as the preinstantiated
|
-- a type derived from type Float, as well as the preinstantiated
|
-- version of this package for type Float.
|
-- version of this package for type Float.
|
-- Prescribed results, including instances prescribed to raise
|
-- Prescribed results, including instances prescribed to raise
|
-- exceptions, are examined in the test cases. In addition,
|
-- exceptions, are examined in the test cases. In addition,
|
-- certain evaluations are performed where the actual function result
|
-- certain evaluations are performed where the actual function result
|
-- is compared with the expected result (within an epsilon range of
|
-- is compared with the expected result (within an epsilon range of
|
-- accuracy).
|
-- accuracy).
|
--
|
--
|
-- TEST FILES:
|
-- TEST FILES:
|
-- The following files comprise this test:
|
-- The following files comprise this test:
|
--
|
--
|
-- FXA5A00.A (foundation code)
|
-- FXA5A00.A (foundation code)
|
-- CXA5A07.A
|
-- CXA5A07.A
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 04 Apr 95 SAIC Initial prerelease version.
|
-- 04 Apr 95 SAIC Initial prerelease version.
|
-- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
|
-- 13 Jun 95 SAIC Incorporated use of Dont_Optimize procedure, and
|
-- use of Result_Within_Range function overloaded for
|
-- use of Result_Within_Range function overloaded for
|
-- FXA5A00.New_Float_Type.
|
-- FXA5A00.New_Float_Type.
|
-- 28 Feb 97 PWB.CTA Removed checks with explicit Cycle => 2.0*Pi
|
-- 28 Feb 97 PWB.CTA Removed checks with explicit Cycle => 2.0*Pi
|
--
|
--
|
-- CHANGE NOTE:
|
-- CHANGE NOTE:
|
-- According to Ken Dritz, author of the Numerics Annex of the RM,
|
-- According to Ken Dritz, author of the Numerics Annex of the RM,
|
-- one should never specify the cycle 2.0*Pi for the trigonometric
|
-- one should never specify the cycle 2.0*Pi for the trigonometric
|
-- functions. In particular, if the machine number for the first
|
-- functions. In particular, if the machine number for the first
|
-- argument is not an exact multiple of the machine number for the
|
-- argument is not an exact multiple of the machine number for the
|
-- explicit cycle, then the specified exact results cannot be
|
-- explicit cycle, then the specified exact results cannot be
|
-- reasonably expected. The affected checks in this test have been
|
-- reasonably expected. The affected checks in this test have been
|
-- marked as comments, with the additional notation "pwb-math".
|
-- marked as comments, with the additional notation "pwb-math".
|
-- Phil Brashear
|
-- Phil Brashear
|
--!
|
--!
|
|
|
with Ada.Numerics.Elementary_Functions;
|
with Ada.Numerics.Elementary_Functions;
|
with Ada.Numerics.Generic_Elementary_Functions;
|
with Ada.Numerics.Generic_Elementary_Functions;
|
with FXA5A00;
|
with FXA5A00;
|
with Report;
|
with Report;
|
|
|
procedure CXA5A07 is
|
procedure CXA5A07 is
|
begin
|
begin
|
|
|
Report.Test ("CXA5A07", "Check that the Arctan function provides " &
|
Report.Test ("CXA5A07", "Check that the Arctan function provides " &
|
"correct results");
|
"correct results");
|
|
|
Test_Block:
|
Test_Block:
|
declare
|
declare
|
|
|
use Ada.Numerics;
|
use Ada.Numerics;
|
use FXA5A00;
|
use FXA5A00;
|
|
|
package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
|
package GEF is new Ada.Numerics.Generic_Elementary_Functions(New_Float);
|
package EF renames Ada.Numerics.Elementary_Functions;
|
package EF renames Ada.Numerics.Elementary_Functions;
|
|
|
Float_Result : Float;
|
Float_Result : Float;
|
New_Float_Result : New_Float;
|
New_Float_Result : New_Float;
|
|
|
procedure Dont_Optimize_Float is new Dont_Optimize(Float);
|
procedure Dont_Optimize_Float is new Dont_Optimize(Float);
|
procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
|
procedure Dont_Optimize_New_Float is new Dont_Optimize(New_Float);
|
|
|
begin
|
begin
|
|
|
-- Testing of Arctan Function, both instantiated and pre-instantiated
|
-- Testing of Arctan Function, both instantiated and pre-instantiated
|
-- version.
|
-- version.
|
|
|
-- Check that Argument_Error is raised by the Arctan function when
|
-- Check that Argument_Error is raised by the Arctan function when
|
-- provided parameter values of 0.0, 0.0.
|
-- provided parameter values of 0.0, 0.0.
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Arctan(Y => 0.0, X => 0.0);
|
New_Float_Result := GEF.Arctan(Y => 0.0, X => 0.0);
|
Report.Failed("Argument_Error not raised when the Arctan " &
|
Report.Failed("Argument_Error not raised when the Arctan " &
|
"function is provided input of 0.0, 0.0");
|
"function is provided input of 0.0, 0.0");
|
Dont_Optimize_New_Float(New_Float_Result, 1);
|
Dont_Optimize_New_Float(New_Float_Result, 1);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Incorrect exception raised by the Arctan " &
|
Report.Failed("Incorrect exception raised by the Arctan " &
|
"function when provided 0.0, 0.0 input parameters");
|
"function when provided 0.0, 0.0 input parameters");
|
end;
|
end;
|
|
|
|
|
-- Check that no exception is raised by the Arctan function when
|
-- Check that no exception is raised by the Arctan function when
|
-- provided a large positive or negative Y parameter value, when
|
-- provided a large positive or negative Y parameter value, when
|
-- using the default value for parameter X.
|
-- using the default value for parameter X.
|
|
|
begin
|
begin
|
Float_Result := EF.Arctan(Y => FXA5A00.Large);
|
Float_Result := EF.Arctan(Y => FXA5A00.Large);
|
Dont_Optimize_Float(Float_Result, 2);
|
Dont_Optimize_Float(Float_Result, 2);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function is " &
|
Report.Failed("Exception raised when the Arctan function is " &
|
"provided a large positive Y parameter value");
|
"provided a large positive Y parameter value");
|
end;
|
end;
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Arctan(Y => New_Float(-FXA5A00.Large));
|
New_Float_Result := GEF.Arctan(Y => New_Float(-FXA5A00.Large));
|
Dont_Optimize_New_Float(New_Float_Result, 3);
|
Dont_Optimize_New_Float(New_Float_Result, 3);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function is " &
|
Report.Failed("Exception raised when the Arctan function is " &
|
"provided a large negative Y parameter value");
|
"provided a large negative Y parameter value");
|
end;
|
end;
|
|
|
|
|
-- Check that no exception is raised by the Arctan function when
|
-- Check that no exception is raised by the Arctan function when
|
-- provided a small positive or negative Y parameter value, when
|
-- provided a small positive or negative Y parameter value, when
|
-- using the default value for parameter X.
|
-- using the default value for parameter X.
|
|
|
begin
|
begin
|
Float_Result := EF.Arctan(Y => FXA5A00.Small);
|
Float_Result := EF.Arctan(Y => FXA5A00.Small);
|
Dont_Optimize_Float(Float_Result, 4);
|
Dont_Optimize_Float(Float_Result, 4);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function is " &
|
Report.Failed("Exception raised when the Arctan function is " &
|
"provided a small positive Y parameter value");
|
"provided a small positive Y parameter value");
|
end;
|
end;
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Arctan(Y => New_Float(-FXA5A00.Small));
|
New_Float_Result := GEF.Arctan(Y => New_Float(-FXA5A00.Small));
|
Dont_Optimize_New_Float(New_Float_Result, 5);
|
Dont_Optimize_New_Float(New_Float_Result, 5);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function is " &
|
Report.Failed("Exception raised when the Arctan function is " &
|
"provided a small negative Y parameter value");
|
"provided a small negative Y parameter value");
|
end;
|
end;
|
|
|
|
|
-- Check that no exception is raised by the Arctan function when
|
-- Check that no exception is raised by the Arctan function when
|
-- provided combinations of large and small positive or negative
|
-- provided combinations of large and small positive or negative
|
-- parameter values for both Y and X input parameters.
|
-- parameter values for both Y and X input parameters.
|
|
|
begin
|
begin
|
Float_Result := EF.Arctan(Y => FXA5A00.Large, X => FXA5A00.Large);
|
Float_Result := EF.Arctan(Y => FXA5A00.Large, X => FXA5A00.Large);
|
Dont_Optimize_Float(Float_Result, 6);
|
Dont_Optimize_Float(Float_Result, 6);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function is " &
|
Report.Failed("Exception raised when the Arctan function is " &
|
"provided large positive X and Y parameter values");
|
"provided large positive X and Y parameter values");
|
end;
|
end;
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Arctan(New_Float(-FXA5A00.Large),
|
New_Float_Result := GEF.Arctan(New_Float(-FXA5A00.Large),
|
X => New_Float(FXA5A00.Small));
|
X => New_Float(FXA5A00.Small));
|
Dont_Optimize_New_Float(New_Float_Result, 7);
|
Dont_Optimize_New_Float(New_Float_Result, 7);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function is " &
|
Report.Failed("Exception raised when the Arctan function is " &
|
"provided a large negative Y parameter value " &
|
"provided a large negative Y parameter value " &
|
"and a small positive X parameter value");
|
"and a small positive X parameter value");
|
end;
|
end;
|
|
|
|
|
begin
|
begin
|
Float_Result := EF.Arctan(Y => FXA5A00.Small, X => FXA5A00.Large);
|
Float_Result := EF.Arctan(Y => FXA5A00.Small, X => FXA5A00.Large);
|
Dont_Optimize_Float(Float_Result, 8);
|
Dont_Optimize_Float(Float_Result, 8);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function is " &
|
Report.Failed("Exception raised when the Arctan function is " &
|
"provided a small positive Y parameter value " &
|
"provided a small positive Y parameter value " &
|
"and a large positive X parameter value");
|
"and a large positive X parameter value");
|
end;
|
end;
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Arctan(New_Float(-FXA5A00.Small),
|
New_Float_Result := GEF.Arctan(New_Float(-FXA5A00.Small),
|
New_Float(-FXA5A00.Large));
|
New_Float(-FXA5A00.Large));
|
Dont_Optimize_New_Float(New_Float_Result, 9);
|
Dont_Optimize_New_Float(New_Float_Result, 9);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function is " &
|
Report.Failed("Exception raised when the Arctan function is " &
|
"provided a small negative Y parameter value " &
|
"provided a small negative Y parameter value " &
|
"and a large negative parameter value");
|
"and a large negative parameter value");
|
end;
|
end;
|
|
|
|
|
-- Check that when the Arctan function is provided a Y parameter value
|
-- Check that when the Arctan function is provided a Y parameter value
|
-- of 0.0 and a positive X parameter input value, the prescribed result
|
-- of 0.0 and a positive X parameter input value, the prescribed result
|
-- of zero is returned.
|
-- of zero is returned.
|
|
|
if GEF.Arctan(Y => 0.0) /= 0.0 or -- Default X value
|
if GEF.Arctan(Y => 0.0) /= 0.0 or -- Default X value
|
EF.Arctan(Y => 0.0, X => FXA5A00.Large) /= 0.0 or
|
EF.Arctan(Y => 0.0, X => FXA5A00.Large) /= 0.0 or
|
--pwb-math: Next line: changed 2.0*Pi to 360.0
|
--pwb-math: Next line: changed 2.0*Pi to 360.0
|
GEF.Arctan(0.0, 360.0) /= 0.0 or
|
GEF.Arctan(0.0, 360.0) /= 0.0 or
|
EF.Arctan(0.0, FXA5A00.Small) /= 0.0
|
EF.Arctan(0.0, FXA5A00.Small) /= 0.0
|
then
|
then
|
Report.Failed("Incorrect results from the Arctan function when " &
|
Report.Failed("Incorrect results from the Arctan function when " &
|
"provided a Y parameter value of 0.0 and various " &
|
"provided a Y parameter value of 0.0 and various " &
|
"positive X parameter values");
|
"positive X parameter values");
|
end if;
|
end if;
|
|
|
|
|
-- Check that the Arctan function provides correct results when provided
|
-- Check that the Arctan function provides correct results when provided
|
-- a variety of Y parameter values.
|
-- a variety of Y parameter values.
|
|
|
if not FXA5A00.Result_Within_Range(EF.Arctan(Pi), 1.26, 0.01) or
|
if not FXA5A00.Result_Within_Range(EF.Arctan(Pi), 1.26, 0.01) or
|
not FXA5A00.Result_Within_Range(EF.Arctan(-Pi), -1.26, 0.01) or
|
not FXA5A00.Result_Within_Range(EF.Arctan(-Pi), -1.26, 0.01) or
|
not FXA5A00.Result_Within_Range(GEF.Arctan(1.0), 0.785, 0.001) or
|
not FXA5A00.Result_Within_Range(GEF.Arctan(1.0), 0.785, 0.001) or
|
not FXA5A00.Result_Within_Range(EF.Arctan(-1.0), -0.785, 0.001) or
|
not FXA5A00.Result_Within_Range(EF.Arctan(-1.0), -0.785, 0.001) or
|
not FXA5A00.Result_Within_Range(GEF.Arctan(0.25), 0.245, 0.001) or
|
not FXA5A00.Result_Within_Range(GEF.Arctan(0.25), 0.245, 0.001) or
|
not FXA5A00.Result_Within_Range(EF.Arctan(0.92), 0.744, 0.001)
|
not FXA5A00.Result_Within_Range(EF.Arctan(0.92), 0.744, 0.001)
|
then
|
then
|
Report.Failed("Incorrect results from the Arctan function when " &
|
Report.Failed("Incorrect results from the Arctan function when " &
|
"provided a variety of Y parameter values");
|
"provided a variety of Y parameter values");
|
end if;
|
end if;
|
|
|
|
|
|
|
-- Check the results of the Arctan function with specified cycle
|
-- Check the results of the Arctan function with specified cycle
|
-- parameter.
|
-- parameter.
|
|
|
-- Check that the Arctan function with specified Cycle parameter
|
-- Check that the Arctan function with specified Cycle parameter
|
-- raises Argument_Error when the value of the Cycle parameter is zero
|
-- raises Argument_Error when the value of the Cycle parameter is zero
|
-- or negative.
|
-- or negative.
|
|
|
begin
|
begin
|
Float_Result := EF.Arctan(Y => Pi, Cycle => 0.0); -- Default X value
|
Float_Result := EF.Arctan(Y => Pi, Cycle => 0.0); -- Default X value
|
Report.Failed("Argument_Error not raised by the Arctan function " &
|
Report.Failed("Argument_Error not raised by the Arctan function " &
|
"with default X parameter value, when the Cycle " &
|
"with default X parameter value, when the Cycle " &
|
"parameter is 0.0");
|
"parameter is 0.0");
|
Dont_Optimize_Float(Float_Result, 10);
|
Dont_Optimize_Float(Float_Result, 10);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Incorrect exception raised by the Arctan " &
|
Report.Failed("Incorrect exception raised by the Arctan " &
|
"function with default X parameter value, when " &
|
"function with default X parameter value, when " &
|
"provided a 0.0 cycle parameter value");
|
"provided a 0.0 cycle parameter value");
|
end;
|
end;
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Arctan(Y => Pi, X => 1.0, Cycle => 0.0);
|
New_Float_Result := GEF.Arctan(Y => Pi, X => 1.0, Cycle => 0.0);
|
Report.Failed("Argument_Error not raised by the Arctan function " &
|
Report.Failed("Argument_Error not raised by the Arctan function " &
|
"when the Cycle parameter is 0.0");
|
"when the Cycle parameter is 0.0");
|
Dont_Optimize_New_Float(New_Float_Result, 11);
|
Dont_Optimize_New_Float(New_Float_Result, 11);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Incorrect exception raised by the Arctan " &
|
Report.Failed("Incorrect exception raised by the Arctan " &
|
"function when provided a 0.0 cycle parameter " &
|
"function when provided a 0.0 cycle parameter " &
|
"value");
|
"value");
|
end;
|
end;
|
|
|
begin
|
begin
|
Float_Result := EF.Arctan(Y => Pi, Cycle => -360.0);
|
Float_Result := EF.Arctan(Y => Pi, Cycle => -360.0);
|
Report.Failed("Argument_Error not raised by the Arctan function " &
|
Report.Failed("Argument_Error not raised by the Arctan function " &
|
"with a default X parameter value, when the Cycle " &
|
"with a default X parameter value, when the Cycle " &
|
"parameter is -360.0");
|
"parameter is -360.0");
|
Dont_Optimize_Float(Float_Result, 12);
|
Dont_Optimize_Float(Float_Result, 12);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Incorrect exception raised by the Arctan " &
|
Report.Failed("Incorrect exception raised by the Arctan " &
|
"function with a default X parameter value, when " &
|
"function with a default X parameter value, when " &
|
"provided a -360.0 cycle parameter value");
|
"provided a -360.0 cycle parameter value");
|
end;
|
end;
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Arctan(Y => Pi, X => 1.0, Cycle => -Pi);
|
New_Float_Result := GEF.Arctan(Y => Pi, X => 1.0, Cycle => -Pi);
|
Report.Failed("Argument_Error not raised by the Arctan function " &
|
Report.Failed("Argument_Error not raised by the Arctan function " &
|
"when the Cycle parameter is -Pi");
|
"when the Cycle parameter is -Pi");
|
Dont_Optimize_New_Float(New_Float_Result, 13);
|
Dont_Optimize_New_Float(New_Float_Result, 13);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Incorrect exception raised by the Arctan " &
|
Report.Failed("Incorrect exception raised by the Arctan " &
|
"function when provided a -Pi cycle parameter " &
|
"function when provided a -Pi cycle parameter " &
|
"value");
|
"value");
|
end;
|
end;
|
|
|
|
|
-- Check that no exception is raised by the Arctan function with
|
-- Check that no exception is raised by the Arctan function with
|
-- specified Cycle parameter, when provided large and small positive
|
-- specified Cycle parameter, when provided large and small positive
|
-- or negative parameter values for both Y and X input parameters.
|
-- or negative parameter values for both Y and X input parameters.
|
|
|
begin
|
begin
|
Float_Result := EF.Arctan(Y => -FXA5A00.Large,
|
Float_Result := EF.Arctan(Y => -FXA5A00.Large,
|
X => -FXA5A00.Large,
|
X => -FXA5A00.Large,
|
--pwb-math: Next line: changed 2.0*Pi to 360.0
|
--pwb-math: Next line: changed 2.0*Pi to 360.0
|
Cycle => 360.0);
|
Cycle => 360.0);
|
Dont_Optimize_Float(Float_Result, 14);
|
Dont_Optimize_Float(Float_Result, 14);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function with " &
|
Report.Failed("Exception raised when the Arctan function with " &
|
"specified Cycle parameter, when provided large " &
|
"specified Cycle parameter, when provided large " &
|
"negative X and Y parameter values");
|
"negative X and Y parameter values");
|
end;
|
end;
|
|
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Arctan(New_Float(FXA5A00.Large),
|
New_Float_Result := GEF.Arctan(New_Float(FXA5A00.Large),
|
X => New_Float(-FXA5A00.Small),
|
X => New_Float(-FXA5A00.Small),
|
--pwb-math: Next line: changed 2.0*Pi to 360.0
|
--pwb-math: Next line: changed 2.0*Pi to 360.0
|
Cycle => 360.0);
|
Cycle => 360.0);
|
Dont_Optimize_New_Float(New_Float_Result, 15);
|
Dont_Optimize_New_Float(New_Float_Result, 15);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function with " &
|
Report.Failed("Exception raised when the Arctan function with " &
|
"specified Cycle parameter, when provided large " &
|
"specified Cycle parameter, when provided large " &
|
"positive Y parameter value and a small negative " &
|
"positive Y parameter value and a small negative " &
|
"X parameter value");
|
"X parameter value");
|
end;
|
end;
|
|
|
|
|
begin
|
begin
|
Float_Result := EF.Arctan(Y => -FXA5A00.Small,
|
Float_Result := EF.Arctan(Y => -FXA5A00.Small,
|
X => -FXA5A00.Large,
|
X => -FXA5A00.Large,
|
--pwb-math: Next line: changed 2.0*Pi to 360.0
|
--pwb-math: Next line: changed 2.0*Pi to 360.0
|
Cycle => 360.0);
|
Cycle => 360.0);
|
Dont_Optimize_Float(Float_Result, 16);
|
Dont_Optimize_Float(Float_Result, 16);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function with " &
|
Report.Failed("Exception raised when the Arctan function with " &
|
"specified Cycle parameter, when provided large " &
|
"specified Cycle parameter, when provided large " &
|
"negative Y parameter value and a large negative " &
|
"negative Y parameter value and a large negative " &
|
"X parameter value");
|
"X parameter value");
|
end;
|
end;
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Arctan(New_Float(FXA5A00.Small),
|
New_Float_Result := GEF.Arctan(New_Float(FXA5A00.Small),
|
New_Float(FXA5A00.Large),
|
New_Float(FXA5A00.Large),
|
--pwb-math: Next line: changed 2.0*Pi to 360.0
|
--pwb-math: Next line: changed 2.0*Pi to 360.0
|
360.0);
|
360.0);
|
Dont_Optimize_New_Float(New_Float_Result, 17);
|
Dont_Optimize_New_Float(New_Float_Result, 17);
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised when the Arctan function with " &
|
Report.Failed("Exception raised when the Arctan function with " &
|
"specified Cycle parameter, when provided a " &
|
"specified Cycle parameter, when provided a " &
|
"small negative Y parameter value and a large " &
|
"small negative Y parameter value and a large " &
|
"positive X parameter value");
|
"positive X parameter value");
|
end;
|
end;
|
|
|
|
|
-- Check that the Arctan function with specified Cycle parameter
|
-- Check that the Arctan function with specified Cycle parameter
|
-- provides correct results when provided a variety of Y parameter
|
-- provides correct results when provided a variety of Y parameter
|
-- input values.
|
-- input values.
|
|
|
--pwb-math if not FXA5A00.Result_Within_Range(EF.Arctan(Pi, Cycle => 2.0*Pi),
|
--pwb-math if not FXA5A00.Result_Within_Range(EF.Arctan(Pi, Cycle => 2.0*Pi),
|
--pwb-math 1.26,
|
--pwb-math 1.26,
|
--pwb-math 0.01) or
|
--pwb-math 0.01) or
|
--pwb-math not FXA5A00.Result_Within_Range(EF.Arctan(-Pi, Cycle => 2.0*Pi),
|
--pwb-math not FXA5A00.Result_Within_Range(EF.Arctan(-Pi, Cycle => 2.0*Pi),
|
--pwb-math -1.26,
|
--pwb-math -1.26,
|
--pwb-math 0.01) or
|
--pwb-math 0.01) or
|
--pwb-math not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 2.0*Pi),
|
--pwb-math not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 2.0*Pi),
|
--pwb-math 0.785,
|
--pwb-math 0.785,
|
--pwb-math 0.001) or
|
--pwb-math 0.001) or
|
--pwb-math not FXA5A00.Result_Within_Range(EF.Arctan(-1.0, Cycle => 2.0*Pi),
|
--pwb-math not FXA5A00.Result_Within_Range(EF.Arctan(-1.0, Cycle => 2.0*Pi),
|
--pwb-math -0.785,
|
--pwb-math -0.785,
|
--pwb-math 0.001) or
|
--pwb-math 0.001) or
|
--pwb-math not FXA5A00.Result_Within_Range(GEF.Arctan(0.16, Cycle => 2.0*Pi),
|
--pwb-math not FXA5A00.Result_Within_Range(GEF.Arctan(0.16, Cycle => 2.0*Pi),
|
--pwb-math 0.159,
|
--pwb-math 0.159,
|
--pwb-math 0.001) or
|
--pwb-math 0.001) or
|
--pwb-math not FXA5A00.Result_Within_Range(EF.Arctan(1.0, Cycle => 360.0),
|
--pwb-math not FXA5A00.Result_Within_Range(EF.Arctan(1.0, Cycle => 360.0),
|
--pwb-math 45.0,
|
--pwb-math 45.0,
|
--pwb-math 0.1) or
|
--pwb-math 0.1) or
|
--pwb-math not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 100.0),
|
--pwb-math not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 100.0),
|
--pwb-math 12.5,
|
--pwb-math 12.5,
|
--pwb-math 0.1)
|
--pwb-math 0.1)
|
|
|
--pwb-math Next 12 lines are replacements for 21 commented lines above
|
--pwb-math Next 12 lines are replacements for 21 commented lines above
|
if not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 2.0*180.0),
|
if not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 2.0*180.0),
|
45.0,
|
45.0,
|
0.001) or
|
0.001) or
|
not FXA5A00.Result_Within_Range(EF.Arctan(-1.0, Cycle => 2.0*180.0),
|
not FXA5A00.Result_Within_Range(EF.Arctan(-1.0, Cycle => 2.0*180.0),
|
-45.0,
|
-45.0,
|
0.001) or
|
0.001) or
|
not FXA5A00.Result_Within_Range(EF.Arctan(1.0, Cycle => 360.0),
|
not FXA5A00.Result_Within_Range(EF.Arctan(1.0, Cycle => 360.0),
|
45.0,
|
45.0,
|
0.1) or
|
0.1) or
|
not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 100.0),
|
not FXA5A00.Result_Within_Range(GEF.Arctan(1.0, Cycle => 100.0),
|
12.5,
|
12.5,
|
0.1)
|
0.1)
|
then
|
then
|
Report.Failed("Incorrect results from the Arctan function with " &
|
Report.Failed("Incorrect results from the Arctan function with " &
|
"specified Cycle parameter when provided a variety " &
|
"specified Cycle parameter when provided a variety " &
|
"of Y parameter values");
|
"of Y parameter values");
|
end if;
|
end if;
|
|
|
|
|
exception
|
exception
|
when others => Report.Failed ("Exception raised in Test_Block");
|
when others => Report.Failed ("Exception raised in Test_Block");
|
end Test_Block;
|
end Test_Block;
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end CXA5A07;
|
end CXA5A07;
|
|
|