-- CXA5A09.A
|
-- CXA5A09.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 Log provides correct results.
|
-- Check that the function Log provides correct results.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- This test examines both the version of Log resulting from the
|
-- This test examines both the version of Log resulting from the
|
-- instantiation of the Ada.Numerics.Generic_Elementary_Functions with
|
-- instantiation of the Ada.Numerics.Generic_Elementary_Functions with
|
-- with a type derived from type Float,as well as the preinstantiated
|
-- with 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)
|
-- CXA5A09.A
|
-- CXA5A09.A
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 11 Apr 95 SAIC Initial prerelease version.
|
-- 11 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.
|
-- 29 Jun 98 EDS Protected exception tests by first testing
|
-- 29 Jun 98 EDS Protected exception tests by first testing
|
-- for 'Machine_Overflows
|
-- for 'Machine_Overflows
|
--
|
--
|
--!
|
--!
|
|
|
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 CXA5A09 is
|
procedure CXA5A09 is
|
begin
|
begin
|
|
|
Report.Test ("CXA5A09", "Check that the Log function provides " &
|
Report.Test ("CXA5A09", "Check that the Log 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;
|
|
|
Arg,
|
Arg,
|
Float_Result : Float := 0.0;
|
Float_Result : Float := 0.0;
|
New_Float_Result : New_Float := 0.0;
|
New_Float_Result : New_Float := 0.0;
|
|
|
Incorrect_Inverse,
|
Incorrect_Inverse,
|
Incorrect_Inverse_Base_2,
|
Incorrect_Inverse_Base_2,
|
Incorrect_Inverse_Base_8,
|
Incorrect_Inverse_Base_8,
|
Incorrect_Inverse_Base_10,
|
Incorrect_Inverse_Base_10,
|
Incorrect_Inverse_Base_16 : Boolean := False;
|
Incorrect_Inverse_Base_16 : Boolean := False;
|
|
|
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 Log Function, both instantiated and pre-instantiated
|
-- Testing of Log Function, both instantiated and pre-instantiated
|
-- version.
|
-- version.
|
|
|
-- Check that Argument_Error is raised when the parameter X is negative.
|
-- Check that Argument_Error is raised when the parameter X is negative.
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Log(X => -1.0);
|
New_Float_Result := GEF.Log(X => -1.0);
|
Report.Failed("Argument_Error not raised by the Log function " &
|
Report.Failed("Argument_Error not raised by the Log function " &
|
"when the input parameter is negative");
|
"when the input parameter is negative");
|
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("Unexpected exception raised by the Log function " &
|
Report.Failed("Unexpected exception raised by the Log function " &
|
"when the input parameter is negative");
|
"when the input parameter is negative");
|
end;
|
end;
|
|
|
begin
|
begin
|
Float_Result := EF.Log(X => -FXA5A00.Large);
|
Float_Result := EF.Log(X => -FXA5A00.Large);
|
Report.Failed("Argument_Error not raised by the Log function " &
|
Report.Failed("Argument_Error not raised by the Log function " &
|
"when the input parameter is negative");
|
"when the input parameter is negative");
|
Dont_Optimize_Float(Float_Result, 2);
|
Dont_Optimize_Float(Float_Result, 2);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Unexpected exception raised by the Log function " &
|
Report.Failed("Unexpected exception raised by the Log function " &
|
"when the input parameter is negative");
|
"when the input parameter is negative");
|
end;
|
end;
|
|
|
|
|
-- Check that Constraint_Error is raised when the Log function is
|
-- Check that Constraint_Error is raised when the Log function is
|
-- provided an input parameter of zero.
|
-- provided an input parameter of zero.
|
|
|
if New_Float'Machine_Overflows = True then
|
if New_Float'Machine_Overflows = True then
|
begin
|
begin
|
New_Float_Result := GEF.Log(X => 0.0);
|
New_Float_Result := GEF.Log(X => 0.0);
|
Report.Failed("Constraint_Error not raised by the Log function " &
|
Report.Failed("Constraint_Error not raised by the Log function " &
|
"when the input parameter is zero");
|
"when the input parameter is zero");
|
Dont_Optimize_New_Float(New_Float_Result, 3);
|
Dont_Optimize_New_Float(New_Float_Result, 3);
|
exception
|
exception
|
when Constraint_Error => null; -- OK, expected exception.
|
when Constraint_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Unexpected exception raised by the Log function "
|
Report.Failed("Unexpected exception raised by the Log function "
|
& "when the input parameter is zero");
|
& "when the input parameter is zero");
|
end;
|
end;
|
end if;
|
end if;
|
|
|
|
|
-- Check for the reference manual prescribed results of the Log function.
|
-- Check for the reference manual prescribed results of the Log function.
|
|
|
if GEF.Log(X => 1.0) /= 0.0 or
|
if GEF.Log(X => 1.0) /= 0.0 or
|
EF.Log(X => 1.0) /= 0.0
|
EF.Log(X => 1.0) /= 0.0
|
then
|
then
|
Report.Failed("Incorrect result from Function Log when provided " &
|
Report.Failed("Incorrect result from Function Log when provided " &
|
"an input parameter value of 1.0");
|
"an input parameter value of 1.0");
|
end if;
|
end if;
|
|
|
|
|
-- Check that the Log function provides correct results when provided
|
-- Check that the Log function provides correct results when provided
|
-- a variety of input parameters.
|
-- a variety of input parameters.
|
|
|
if not FXA5A00.Result_Within_Range(GEF.Log(0.015), -4.20, 0.01) or
|
if not FXA5A00.Result_Within_Range(GEF.Log(0.015), -4.20, 0.01) or
|
not FXA5A00.Result_Within_Range(GEF.Log(0.592), -0.524, 0.001) or
|
not FXA5A00.Result_Within_Range(GEF.Log(0.592), -0.524, 0.001) or
|
not FXA5A00.Result_Within_Range(GEF.Log(0.997), -0.003, 0.001) or
|
not FXA5A00.Result_Within_Range(GEF.Log(0.997), -0.003, 0.001) or
|
not FXA5A00.Result_Within_Range(GEF.Log(1.341), 0.293, 0.001) or
|
not FXA5A00.Result_Within_Range(GEF.Log(1.341), 0.293, 0.001) or
|
not FXA5A00.Result_Within_Range( EF.Log(2.826), 1.04, 0.01) or
|
not FXA5A00.Result_Within_Range( EF.Log(2.826), 1.04, 0.01) or
|
not FXA5A00.Result_Within_Range( EF.Log(10.052), 2.31, 0.01) or
|
not FXA5A00.Result_Within_Range( EF.Log(10.052), 2.31, 0.01) or
|
not FXA5A00.Result_Within_Range( EF.Log(2569.143), 7.85, 0.01)
|
not FXA5A00.Result_Within_Range( EF.Log(2569.143), 7.85, 0.01)
|
then
|
then
|
Report.Failed("Incorrect results from Function Log when provided " &
|
Report.Failed("Incorrect results from Function Log when provided " &
|
"a variety of input parameter values");
|
"a variety of input parameter values");
|
end if;
|
end if;
|
|
|
Arg := 0.001;
|
Arg := 0.001;
|
while Arg < 1.0 and not Incorrect_Inverse loop
|
while Arg < 1.0 and not Incorrect_Inverse loop
|
if not Result_Within_Range(EF."**"(e,EF.Log(Arg)), Arg, 0.001) then
|
if not Result_Within_Range(EF."**"(e,EF.Log(Arg)), Arg, 0.001) then
|
Incorrect_Inverse := True;
|
Incorrect_Inverse := True;
|
end if;
|
end if;
|
Arg := Arg + 0.001;
|
Arg := Arg + 0.001;
|
end loop;
|
end loop;
|
|
|
if Incorrect_Inverse then
|
if Incorrect_Inverse then
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
"Log function over argument range 0.001..1.0");
|
"Log function over argument range 0.001..1.0");
|
Incorrect_Inverse := False;
|
Incorrect_Inverse := False;
|
end if;
|
end if;
|
|
|
Arg := 1.0;
|
Arg := 1.0;
|
while Arg < 10.0 and not Incorrect_Inverse loop
|
while Arg < 10.0 and not Incorrect_Inverse loop
|
if not Result_Within_Range(EF."**"(e,EF.Log(Arg)), Arg, 0.01) then
|
if not Result_Within_Range(EF."**"(e,EF.Log(Arg)), Arg, 0.01) then
|
Incorrect_Inverse := True;
|
Incorrect_Inverse := True;
|
end if;
|
end if;
|
Arg := Arg + 0.01;
|
Arg := Arg + 0.01;
|
end loop;
|
end loop;
|
|
|
if Incorrect_Inverse then
|
if Incorrect_Inverse then
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
"Log function over argument range 1.0..10.0");
|
"Log function over argument range 1.0..10.0");
|
Incorrect_Inverse := False;
|
Incorrect_Inverse := False;
|
end if;
|
end if;
|
|
|
Arg := 1.0;
|
Arg := 1.0;
|
while Arg < 1000.0 and not Incorrect_Inverse loop
|
while Arg < 1000.0 and not Incorrect_Inverse loop
|
if not Result_Within_Range(EF."**"(e,EF.Log(Arg)), Arg, 0.1) then
|
if not Result_Within_Range(EF."**"(e,EF.Log(Arg)), Arg, 0.1) then
|
Incorrect_Inverse := True;
|
Incorrect_Inverse := True;
|
end if;
|
end if;
|
Arg := Arg + 1.0;
|
Arg := Arg + 1.0;
|
end loop;
|
end loop;
|
|
|
if Incorrect_Inverse then
|
if Incorrect_Inverse then
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
"Log function over argument range 1.0..1000.0");
|
"Log function over argument range 1.0..1000.0");
|
end if;
|
end if;
|
|
|
|
|
-- Testing of Log Function, with specified Base parameter, both
|
-- Testing of Log Function, with specified Base parameter, both
|
-- instantiated and pre-instantiated versions.
|
-- instantiated and pre-instantiated versions.
|
|
|
-- Check that Argument_Error is raised by the Log function with
|
-- Check that Argument_Error is raised by the Log function with
|
-- specified Base parameter, when the X parameter value is negative.
|
-- specified Base parameter, when the X parameter value is negative.
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Log(X => -1.0, Base => 16.0);
|
New_Float_Result := GEF.Log(X => -1.0, Base => 16.0);
|
Report.Failed("Argument_Error not raised by the Log function " &
|
Report.Failed("Argument_Error not raised by the Log function " &
|
"with Base parameter, when the input parameter " &
|
"with Base parameter, when the input parameter " &
|
"value is -1.0");
|
"value is -1.0");
|
Dont_Optimize_New_Float(New_Float_Result, 4);
|
Dont_Optimize_New_Float(New_Float_Result, 4);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Unexpected exception raised by the Log function " &
|
Report.Failed("Unexpected exception raised by the Log function " &
|
"with Base parameter, when the X parameter value " &
|
"with Base parameter, when the X parameter value " &
|
"is -1.0");
|
"is -1.0");
|
end;
|
end;
|
|
|
begin
|
begin
|
Float_Result := EF.Log(X => -FXA5A00.Large, Base => 8.0);
|
Float_Result := EF.Log(X => -FXA5A00.Large, Base => 8.0);
|
Report.Failed("Argument_Error not raised by the Log function " &
|
Report.Failed("Argument_Error not raised by the Log function " &
|
"with Base parameter, when the X parameter " &
|
"with Base parameter, when the X parameter " &
|
"value is a large negative value");
|
"value is a large negative value");
|
Dont_Optimize_Float(Float_Result, 5);
|
Dont_Optimize_Float(Float_Result, 5);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Unexpected exception raised by the Log function " &
|
Report.Failed("Unexpected exception raised by the Log function " &
|
"with Base parameter, when the X parameter " &
|
"with Base parameter, when the X parameter " &
|
"value is a large negative value");
|
"value is a large negative value");
|
end;
|
end;
|
|
|
|
|
-- Check that Argument_Error is raised by the Log function when
|
-- Check that Argument_Error is raised by the Log function when
|
-- the specified Base parameter is zero.
|
-- the specified Base parameter is zero.
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Log(X => 10.0, Base => 0.0);
|
New_Float_Result := GEF.Log(X => 10.0, Base => 0.0);
|
Report.Failed("Argument_Error not raised by the Log function " &
|
Report.Failed("Argument_Error not raised by the Log function " &
|
"with Base parameter of 0.0");
|
"with Base parameter of 0.0");
|
Dont_Optimize_New_Float(New_Float_Result, 6);
|
Dont_Optimize_New_Float(New_Float_Result, 6);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Unexpected exception raised by the Log function " &
|
Report.Failed("Unexpected exception raised by the Log function " &
|
"with Base parameter of 0.0");
|
"with Base parameter of 0.0");
|
end;
|
end;
|
|
|
|
|
-- Check that Argument_Error is raised by the Log function when
|
-- Check that Argument_Error is raised by the Log function when
|
-- the specified Base parameter is one.
|
-- the specified Base parameter is one.
|
|
|
begin
|
begin
|
Float_Result := EF.Log(X => 12.3, Base => 1.0);
|
Float_Result := EF.Log(X => 12.3, Base => 1.0);
|
Report.Failed("Argument_Error not raised by the Log function " &
|
Report.Failed("Argument_Error not raised by the Log function " &
|
"with Base parameter of 1.0");
|
"with Base parameter of 1.0");
|
Dont_Optimize_Float(Float_Result, 7);
|
Dont_Optimize_Float(Float_Result, 7);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Unexpected exception raised by the Log function " &
|
Report.Failed("Unexpected exception raised by the Log function " &
|
"with Base parameter of 1.0");
|
"with Base parameter of 1.0");
|
end;
|
end;
|
|
|
|
|
-- Check that Argument_Error is raised by the Log function when
|
-- Check that Argument_Error is raised by the Log function when
|
-- the specified Base parameter is negative.
|
-- the specified Base parameter is negative.
|
|
|
begin
|
begin
|
New_Float_Result := GEF.Log(X => 12.3, Base => -10.0);
|
New_Float_Result := GEF.Log(X => 12.3, Base => -10.0);
|
Report.Failed("Argument_Error not raised by the Log function " &
|
Report.Failed("Argument_Error not raised by the Log function " &
|
"with negative Base parameter");
|
"with negative Base parameter");
|
Dont_Optimize_New_Float(New_Float_Result, 8);
|
Dont_Optimize_New_Float(New_Float_Result, 8);
|
exception
|
exception
|
when Argument_Error => null; -- OK, expected exception.
|
when Argument_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Unexpected exception raised by the Log function " &
|
Report.Failed("Unexpected exception raised by the Log function " &
|
"with negative Base parameter");
|
"with negative Base parameter");
|
end;
|
end;
|
|
|
|
|
-- Check that Constraint_Error is raised by the Log function when the
|
-- Check that Constraint_Error is raised by the Log function when the
|
-- input X parameter value is 0.0.
|
-- input X parameter value is 0.0.
|
|
|
if New_Float'Machine_Overflows = True then
|
if New_Float'Machine_Overflows = True then
|
begin
|
begin
|
New_Float_Result := GEF.Log(X => 0.0, Base => 16.0);
|
New_Float_Result := GEF.Log(X => 0.0, Base => 16.0);
|
Report.Failed("Constraint_Error not raised by the Log function " &
|
Report.Failed("Constraint_Error not raised by the Log function " &
|
"with specified Base parameter, when the value of " &
|
"with specified Base parameter, when the value of " &
|
"the parameter X is 0.0");
|
"the parameter X is 0.0");
|
Dont_Optimize_New_Float(New_Float_Result, 9);
|
Dont_Optimize_New_Float(New_Float_Result, 9);
|
exception
|
exception
|
when Constraint_Error => null; -- OK, expected exception.
|
when Constraint_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Unexpected exception raised by Function Log" &
|
Report.Failed("Unexpected exception raised by Function Log" &
|
"with specified Base parameter, when the value " &
|
"with specified Base parameter, when the value " &
|
"of the parameter X is 0.0");
|
"of the parameter X is 0.0");
|
end;
|
end;
|
end if;
|
end if;
|
|
|
-- Check for the prescribed results of the Log function with specified
|
-- Check for the prescribed results of the Log function with specified
|
-- Base parameter.
|
-- Base parameter.
|
|
|
if GEF.Log(X => 1.0, Base => 16.0) /= 0.0 or
|
if GEF.Log(X => 1.0, Base => 16.0) /= 0.0 or
|
EF.Log(X => 1.0, Base => 10.0) /= 0.0 or
|
EF.Log(X => 1.0, Base => 10.0) /= 0.0 or
|
GEF.Log(1.0, Base => 8.0) /= 0.0 or
|
GEF.Log(1.0, Base => 8.0) /= 0.0 or
|
EF.Log(1.0, 2.0) /= 0.0
|
EF.Log(1.0, 2.0) /= 0.0
|
then
|
then
|
Report.Failed("Incorrect result from Function Log with specified " &
|
Report.Failed("Incorrect result from Function Log with specified " &
|
"Base parameter when provided an parameter X input " &
|
"Base parameter when provided an parameter X input " &
|
"value of 1.0");
|
"value of 1.0");
|
end if;
|
end if;
|
|
|
|
|
-- Check that the Log function with specified Base parameter provides
|
-- Check that the Log function with specified Base parameter provides
|
-- correct results when provided a variety of input parameters.
|
-- correct results when provided a variety of input parameters.
|
|
|
if not Result_Within_Range(GEF.Log( 10.0, e), 2.30, 0.01) or
|
if not Result_Within_Range(GEF.Log( 10.0, e), 2.30, 0.01) or
|
not Result_Within_Range( EF.Log( 8.0, 2.0), 3.0, 0.01) or
|
not Result_Within_Range( EF.Log( 8.0, 2.0), 3.0, 0.01) or
|
not Result_Within_Range(GEF.Log(256.0, 2.0), 8.0, 0.01) or
|
not Result_Within_Range(GEF.Log(256.0, 2.0), 8.0, 0.01) or
|
not Result_Within_Range( EF.Log(512.0, 8.0), 3.0, 0.01) or
|
not Result_Within_Range( EF.Log(512.0, 8.0), 3.0, 0.01) or
|
not Result_Within_Range(GEF.Log(0.5649, e), -0.57, 0.01) or
|
not Result_Within_Range(GEF.Log(0.5649, e), -0.57, 0.01) or
|
not Result_Within_Range( EF.Log(1.7714, e), 0.57, 0.01) or
|
not Result_Within_Range( EF.Log(1.7714, e), 0.57, 0.01) or
|
not Result_Within_Range(GEF.Log(0.5718, 10.0), -0.243, 0.001) or
|
not Result_Within_Range(GEF.Log(0.5718, 10.0), -0.243, 0.001) or
|
not Result_Within_Range( EF.Log(466.25, 10.0), 2.67, 0.01)
|
not Result_Within_Range( EF.Log(466.25, 10.0), 2.67, 0.01)
|
then
|
then
|
Report.Failed("Incorrect results from Function Log with specified " &
|
Report.Failed("Incorrect results from Function Log with specified " &
|
"Base parameter, when provided a variety of input " &
|
"Base parameter, when provided a variety of input " &
|
"parameter values");
|
"parameter values");
|
end if;
|
end if;
|
|
|
|
|
Arg := 1.0;
|
Arg := 1.0;
|
while Arg < 1000.0 and
|
while Arg < 1000.0 and
|
not (Incorrect_Inverse_Base_2 and Incorrect_Inverse_Base_8 and
|
not (Incorrect_Inverse_Base_2 and Incorrect_Inverse_Base_8 and
|
Incorrect_Inverse_Base_10 and Incorrect_Inverse_Base_16)
|
Incorrect_Inverse_Base_10 and Incorrect_Inverse_Base_16)
|
loop
|
loop
|
if not FXA5A00.Result_Within_Range(EF."**"(2.0,EF.Log(Arg,2.0)),
|
if not FXA5A00.Result_Within_Range(EF."**"(2.0,EF.Log(Arg,2.0)),
|
Arg,
|
Arg,
|
0.001)
|
0.001)
|
then
|
then
|
Incorrect_Inverse_Base_2 := True;
|
Incorrect_Inverse_Base_2 := True;
|
end if;
|
end if;
|
if not FXA5A00.Result_Within_Range(EF."**"(8.0,EF.Log(Arg,8.0)),
|
if not FXA5A00.Result_Within_Range(EF."**"(8.0,EF.Log(Arg,8.0)),
|
Arg,
|
Arg,
|
0.001)
|
0.001)
|
then
|
then
|
Incorrect_Inverse_Base_8 := True;
|
Incorrect_Inverse_Base_8 := True;
|
end if;
|
end if;
|
if not FXA5A00.Result_Within_Range(EF."**"(10.0,EF.Log(Arg,10.0)),
|
if not FXA5A00.Result_Within_Range(EF."**"(10.0,EF.Log(Arg,10.0)),
|
Arg,
|
Arg,
|
0.001)
|
0.001)
|
then
|
then
|
Incorrect_Inverse_Base_10 := True;
|
Incorrect_Inverse_Base_10 := True;
|
end if;
|
end if;
|
if not FXA5A00.Result_Within_Range(EF."**"(16.0,EF.Log(Arg,16.0)),
|
if not FXA5A00.Result_Within_Range(EF."**"(16.0,EF.Log(Arg,16.0)),
|
Arg,
|
Arg,
|
0.001)
|
0.001)
|
then
|
then
|
Incorrect_Inverse_Base_16 := True;
|
Incorrect_Inverse_Base_16 := True;
|
end if;
|
end if;
|
Arg := Arg + 1.0;
|
Arg := Arg + 1.0;
|
end loop;
|
end loop;
|
|
|
if Incorrect_Inverse_Base_2 then
|
if Incorrect_Inverse_Base_2 then
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
"Log function for Base 2");
|
"Log function for Base 2");
|
end if;
|
end if;
|
|
|
if Incorrect_Inverse_Base_8 then
|
if Incorrect_Inverse_Base_8 then
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
"Log function for Base 8");
|
"Log function for Base 8");
|
end if;
|
end if;
|
|
|
if Incorrect_Inverse_Base_10 then
|
if Incorrect_Inverse_Base_10 then
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
"Log function for Base 10");
|
"Log function for Base 10");
|
end if;
|
end if;
|
|
|
if Incorrect_Inverse_Base_16 then
|
if Incorrect_Inverse_Base_16 then
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
Report.Failed("Incorrect inverse result comparing ""**"" and " &
|
"Log function for Base 16");
|
"Log function for Base 16");
|
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 CXA5A09;
|
end CXA5A09;
|
|
|