kerneltest/e32test/bench/t_r64fnc.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
    31 TReal64 AntiOptimization[16] = {0.1,	1,	3.14159265358979323846,		10.01,
    31 TReal64 AntiOptimization[16] = {0.1,	1,	3.14159265358979323846,		10.01,
    32 								2.7,	3,	27.2,	11.23,
    32 								2.7,	3,	27.2,	11.23,
    33 								76.1,	9,	56.1,	1/9,
    33 								76.1,	9,	56.1,	1/9,
    34 								1/3,	22,	99.7,	42};
    34 								1/3,	22,	99.7,	42};
    35 
    35 
    36 GLREF_D volatile TUint Count;
    36 GLREF_D volatile TUint count;
    37 
       
    38 #include <e32btrace.h>
       
    39 
       
    40 void Step()
       
    41 	{
       
    42 	if (++Count & 0xffff)
       
    43 		return;
       
    44 	BTrace4(BTrace::ETest1, 0, Count);
       
    45 	}
       
    46 
    37 
    47 TInt TReal64Addition(TAny*)
    38 TInt TReal64Addition(TAny*)
    48     {
    39     {
    49 	Count=0;
    40 	count=0;
    50 
    41 
    51     FOREVER
    42     FOREVER
    52         {
    43         {
    53 		r=AntiOptimization[Count & 0xf];
    44 		r=AntiOptimization[count & 0xf];
    54 		r+=One;
    45 		r+=One;
    55 		r+=One;
    46 		r+=One;
    56 		r+=One;
    47 		r+=One;
    57 		r+=One;
    48 		r+=One;
    58 		r+=One;
    49 		r+=One;
    59 		r+=One;
    50 		r+=One;
    60 		r+=One;
    51 		r+=One;
    61 		r+=One;
    52 		r+=One;
    62 		r+=One;
    53 		r+=One;
    63 		r+=One;
    54 		r+=One;
    64         Step();
    55         count++;
    65         }
    56         }
    66     }
    57     }
    67 
    58 
    68 TInt TReal64Subtraction(TAny*)
    59 TInt TReal64Subtraction(TAny*)
    69     {
    60     {
    70 	Count=0;
    61 	count=0;
    71 
    62 
    72     FOREVER
    63     FOREVER
    73         {
    64         {
    74 		r=AntiOptimization[Count & 0xf];
    65 		r=AntiOptimization[count & 0xf];
    75 		r-=Ten;
    66 		r-=Ten;
    76 		r-=Ten;
    67 		r-=Ten;
    77 		r-=Ten;
    68 		r-=Ten;
    78 		r-=Ten;
    69 		r-=Ten;
    79 		r-=Ten;
    70 		r-=Ten;
    80 		r-=Ten;
    71 		r-=Ten;
    81 		r-=Ten;
    72 		r-=Ten;
    82 		r-=Ten;
    73 		r-=Ten;
    83 		r-=Ten;
    74 		r-=Ten;
    84 		r-=Ten;
    75 		r-=Ten;
    85         Step();
    76         count++;
    86         }
    77         }
    87     }
    78     }
    88 
    79 
    89 TInt TReal64Multiplication(TAny*)
    80 TInt TReal64Multiplication(TAny*)
    90     {
    81     {
    91 	Count=0;
    82 	count=0;
    92     FOREVER
    83     FOREVER
    93         {
    84         {
    94 		r=AntiOptimization[Count & 0xf];
    85 		r=AntiOptimization[count & 0xf];
    95 		r*=Pi;
    86 		r*=Pi;
    96 		r*=Pi;
    87 		r*=Pi;
    97 		r*=Pi;
    88 		r*=Pi;
    98 		r*=Pi;
    89 		r*=Pi;
    99 		r*=Pi;
    90 		r*=Pi;
   100 		r*=Pi;
    91 		r*=Pi;
   101 		r*=Pi;
    92 		r*=Pi;
   102 		r*=Pi;
    93 		r*=Pi;
   103 		r*=Pi;
    94 		r*=Pi;
   104 		r*=Pi;
    95 		r*=Pi;
   105         Step();
    96         count++;
   106         }
    97         }
   107     }
    98     }
   108 
    99 
   109 TInt TReal64Division(TAny*)
   100 TInt TReal64Division(TAny*)
   110     {
   101     {
   111 	Count=0;
   102 	count=0;
   112 	
   103 	
   113     FOREVER
   104     FOREVER
   114         {
   105         {
   115 		r=AntiOptimization[Count & 0xf];
   106 		r=AntiOptimization[count & 0xf];
   116 		r/=Ten;
   107 		r/=Ten;
   117 		r/=Ten;
   108 		r/=Ten;
   118 		r/=Ten;
   109 		r/=Ten;
   119 		r/=Ten;
   110 		r/=Ten;
   120 		r/=Ten;
   111 		r/=Ten;
   121 		r/=Ten;
   112 		r/=Ten;
   122 		r/=Ten;
   113 		r/=Ten;
   123 		r/=Ten;
   114 		r/=Ten;
   124 		r/=Ten;
   115 		r/=Ten;
   125 		r/=Ten;
   116 		r/=Ten;
   126         Step();
   117         count++;
   127         }
   118         }
   128     }
   119     }
   129 
   120 
   130 TInt TRealSqrt(TAny*)
   121 TInt TRealSqrt(TAny*)
   131     {
   122     {
   132 	Count=0;
       
   133 
   123 
   134 	TReal r;
   124 	TReal r;
   135 
   125 
   136     FOREVER
   126     FOREVER
   137         {
   127         {
   143 		Math::Sqrt(r,2.71828182845904524);
   133 		Math::Sqrt(r,2.71828182845904524);
   144 		Math::Sqrt(r,0.69314718055994531);
   134 		Math::Sqrt(r,0.69314718055994531);
   145 		Math::Sqrt(r,1.414213562373);
   135 		Math::Sqrt(r,1.414213562373);
   146 		Math::Sqrt(r,1.7320508078);
   136 		Math::Sqrt(r,1.7320508078);
   147 		Math::Sqrt(r,299792458.0);
   137 		Math::Sqrt(r,299792458.0);
   148         Step();
   138         count++;
   149         }
   139         }
   150     }
   140     }
   151 
   141 
   152 TInt TRealSin(TAny*)
   142 TInt TRealSin(TAny*)
   153     {
   143     {
   154 	Count=0;
       
   155 
   144 
   156 	TReal r=7;
   145 	TReal r=7;
   157 
   146 
   158     FOREVER
   147     FOREVER
   159         {
   148         {
   165 		Math::Sin(r,6.0);
   154 		Math::Sin(r,6.0);
   166 		Math::Sin(r,7.0);
   155 		Math::Sin(r,7.0);
   167 		Math::Sin(r,8.0);
   156 		Math::Sin(r,8.0);
   168 		Math::Sin(r,9.0);
   157 		Math::Sin(r,9.0);
   169 		Math::Sin(r,-1.0);
   158 		Math::Sin(r,-1.0);
   170         Step();
   159         count++;
   171         }
   160         }
   172     }
   161     }
   173 
   162 
   174 TInt TRealLn(TAny*)
   163 TInt TRealLn(TAny*)
   175     {
   164     {
   176 	Count=0;
       
   177 
   165 
   178 	TReal r=7;
   166 	TReal r=7;
   179 
   167 
   180     FOREVER
   168     FOREVER
   181         {
   169         {
   187 		Math::Ln(r,5.0);
   175 		Math::Ln(r,5.0);
   188 		Math::Ln(r,7.0);
   176 		Math::Ln(r,7.0);
   189 		Math::Ln(r,11.0);
   177 		Math::Ln(r,11.0);
   190 		Math::Ln(r,13.0);
   178 		Math::Ln(r,13.0);
   191 		Math::Ln(r,17.0);
   179 		Math::Ln(r,17.0);
   192         Step();
   180         count++;
   193         }
   181         }
   194     }
   182     }
   195 
   183 
   196 TInt TRealExp(TAny*)
   184 TInt TRealExp(TAny*)
   197     {
   185     {
   198 	Count=0;
       
   199 
   186 
   200 	TReal r=7;
   187 	TReal r=7;
   201 
   188 
   202     FOREVER
   189     FOREVER
   203         {
   190         {
   209 		Math::Exp(r,-1.0);
   196 		Math::Exp(r,-1.0);
   210 		Math::Exp(r,2.0);
   197 		Math::Exp(r,2.0);
   211 		Math::Exp(r,-2.0);
   198 		Math::Exp(r,-2.0);
   212 		Math::Exp(r,11.0);
   199 		Math::Exp(r,11.0);
   213 		Math::Exp(r,-11.0);
   200 		Math::Exp(r,-11.0);
   214         Step();
   201         count++;
   215         }
   202         }
   216     }
   203     }
   217 
   204 
   218 TInt TRealAsin(TAny*)
   205 TInt TRealAsin(TAny*)
   219     {
   206     {
   220 	Count=0;
       
   221 
   207 
   222 	TReal r=7;
   208 	TReal r=7;
   223 
   209 
   224     FOREVER
   210     FOREVER
   225         {
   211         {
   231 		Math::ASin(r,0.6);
   217 		Math::ASin(r,0.6);
   232 		Math::ASin(r,0.7);
   218 		Math::ASin(r,0.7);
   233 		Math::ASin(r,0.8);
   219 		Math::ASin(r,0.8);
   234 		Math::ASin(r,0.9);
   220 		Math::ASin(r,0.9);
   235 		Math::ASin(r,-0.9);
   221 		Math::ASin(r,-0.9);
   236         Step();
   222         count++;
   237         }
   223         }
   238     }
   224     }
   239 
   225 
   240 TInt TRealAtan(TAny*)
   226 TInt TRealAtan(TAny*)
   241     {
   227     {
   242 	Count=0;
       
   243 
   228 
   244 	TReal r=7;
   229 	TReal r=7;
   245 
   230 
   246     FOREVER
   231     FOREVER
   247         {
   232         {
   253 		Math::ATan(r,1.1);
   238 		Math::ATan(r,1.1);
   254 		Math::ATan(r,1.3);
   239 		Math::ATan(r,1.3);
   255 		Math::ATan(r,1.5);
   240 		Math::ATan(r,1.5);
   256 		Math::ATan(r,1.7);
   241 		Math::ATan(r,1.7);
   257 		Math::ATan(r,2.9);
   242 		Math::ATan(r,2.9);
   258         Step();
   243         count++;
   259         }
   244         }
   260     }
   245     }
   261 
   246 
   262 TInt TRealTan(TAny*)
   247 TInt TRealTan(TAny*)
   263     {
   248     {
   264 	Count=0;
       
   265 
   249 
   266 	TReal r=7;
   250 	TReal r=7;
   267 
   251 
   268     FOREVER
   252     FOREVER
   269         {
   253         {
   275 		Math::Tan(r,6.0);
   259 		Math::Tan(r,6.0);
   276 		Math::Tan(r,7.0);
   260 		Math::Tan(r,7.0);
   277 		Math::Tan(r,8.0);
   261 		Math::Tan(r,8.0);
   278 		Math::Tan(r,9.0);
   262 		Math::Tan(r,9.0);
   279 		Math::Tan(r,-1.0);
   263 		Math::Tan(r,-1.0);
   280         Step();
   264         count++;
   281         }
   265         }
   282     }
   266     }
   283 
   267 
   284 TInt TRealPower(TAny*)
   268 TInt TRealPower(TAny*)
   285     {
   269     {
   286 	Count=0;
       
   287 
   270 
   288 	TReal r=7;
   271 	TReal r=7;
   289 
   272 
   290     FOREVER
   273     FOREVER
   291         {
   274         {
   297 		Math::Pow(r,0.86602540378,-1.6180334);
   280 		Math::Pow(r,0.86602540378,-1.6180334);
   298 		Math::Pow(r,7.0,0.5772156649);
   281 		Math::Pow(r,7.0,0.5772156649);
   299 		Math::Pow(r,95.4,1.57079);
   282 		Math::Pow(r,95.4,1.57079);
   300 		Math::Pow(r,317.9,0.3333333333333333);
   283 		Math::Pow(r,317.9,0.3333333333333333);
   301 		Math::Pow(r,299792458,-2.718281828459045235);
   284 		Math::Pow(r,299792458,-2.718281828459045235);
   302         Step();
   285         count++;
   303         }
   286         }
   304     }
   287     }
   305 
   288