separate( Test_Log_Family ) procedure Test_Log_Interval( N, N_Arguments : in Int_Type; MRE_Base, MRE_Mach, Bad_Arg, Bad_Val : out Float_Type; Outcome : out Status ) is NLog2_Pieces : array( Int_Type range 1..4 ) of Float_Type; Comp_Log_Arg : array( Int_Type range 1..Value_Table_Size ) of Float_Type; Two_to : constant array ( Int_Type range -3..3 ) of Float_Type := ( 0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0 ); NLog2_Lead, NLog2_Trail, Error, Max_Error, Scale, Factor, Tmp_Arg, Tmp_Val : Float_Type; Zero : constant Float_Type := 0.0; N_Loops, M1, M2, J, K, L, M, I_Tmp2, I_Tmp3 : Int_Type; Arg, Log_of_Arg : Value_Table; begin for Index in Int_Type(1)..4 loop NLog2_Pieces(Index) := Float_Type(N)*Log2_Pieces(Index); end loop; I_Tmp2 := Int_Type( NLog2_Pieces(2) * 2#1.0#E12 ); I_Tmp3 := Int_Type( NLog2_Pieces(3) * 2#1.0#E12 ); NLog2_Lead := NLog2_Pieces(1) + Float_Type(I_Tmp2)*2#1.0#E-12; NLog2_Lead := NLog2_Lead + Float_Type(I_Tmp3)*2#1.0#E-12; NLog2_Trail := NLog2_Pieces(4) + (NLog2_Pieces(3) - Float_Type(I_Tmp3)*2#1.0#E-12); NLog2_Trail := NLog2_Trail + (NLog2_Pieces(2) - Float_Type(I_Tmp2)*2#1.0#E-12); N_Loops := N_Arguments / Value_Table_Size; if N_Loops < 3 then N_Loops := 3; end if; Outcome := OK; Error := Zero; Max_Error := Zero; Bad_Arg := Zero; Bad_Val := Zero; for Loop_Cnt in 1..N_Loops loop case Loop_Cnt is when 1 => J := Rand_Int(J_Left, J_Right); K := 0; L := 0; M := 0; when 2 => J := 0; K := K_Right; L := L_Right; M := M_Right; when others => J := Rand_Int(J_Left, J_Right); K := Rand_Int(K_Left, K_Right); L := Rand_Int(L_Left, L_Right); M := Rand_Int(M_Left, M_Right); end case; Core_Test_Log(N, NLog2_Lead, NLog2_Trail, J, K, L, M, Arg, Log_of_Arg); begin for Index in 1..Value_Table_Size loop Tmp_Arg := Arg(Index, Lead) + Arg(Index, Trail); Comp_Log_Arg(Index) := Test_Functions.Log( Tmp_Arg ); end loop; --loop for invoking Log under test exception when others => Outcome := Failed; Bad_Arg := Tmp_Arg; return; end; for Index in 1..Value_Table_Size loop Tmp_Val := Log_of_Arg(Index, Lead) + Log_of_Arg(Index, Trail); Error := Log_of_Arg(Index,Lead) - Comp_Log_Arg(Index); Error := Error + Log_of_Arg(Index,Trail); if (Tmp_Val = 0.0) then Error := Error * 1.0E30; else Error := Error / Tmp_Val; end if; Error := abs( Error ); if Error > Max_Error then Max_Error := Error; Bad_Arg := Arg(Index,Lead) + Arg(Index,Trail); Bad_Val := Comp_Log_Arg(Index); end if; end loop; --loop for calculating relative error end loop; --outermost loop begin MRE_Base := Base_Eps_Inv * Max_Error; MRE_Mach := Mach_Eps_Inv * Max_Error; exception when others => MRE_Base := Base_Eps_Inv * 500.0; MRE_Mach := Mach_Eps_Inv * 500.0; end; return; end Test_Log_Interval;