Changeset 1020
 Timestamp:
 Oct 12, 2011, 3:16:03 AM (10 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/real.cpp
r1019 r1020 669 669 for (int i = 1; ; i++) 670 670 { 671 fact *= (real)i; 672 real newret = ret + xn / fact; 671 real newret = ret + xn; 673 672 if (newret == ret) 674 673 break; 675 674 ret = newret; 675 real mul = (i + 1); 676 fact *= mul; 677 ret *= mul; 676 678 xn *= x; 677 679 } 680 ret /= fact; 678 681 679 682 return ret; … … 803 806 absx = real::R_PI  absx; 804 807 805 real ret = real::R_0, fact = real::R_1, xn = absx, x2 =absx * absx;808 real ret = real::R_0, fact = real::R_1, xn = absx, mx2 = absx * absx; 806 809 for (int i = 1; ; i += 2) 807 810 { 808 real newret = ret + xn / fact;811 real newret = ret + xn; 809 812 if (newret == ret) 810 813 break; 811 814 ret = newret; 812 xn *= x2; 813 fact *= (real)((i + 1) * (i + 2)); 814 } 815 real mul = (i + 1) * (i + 2); 816 fact *= mul; 817 ret *= mul; 818 xn *= mx2; 819 } 820 ret /= fact; 815 821 816 822 /* Propagate sign */ 
trunk/test/benchmark/real.cpp
r977 r1020 57 57 invfact = invfact / real(1.0 + i); 58 58 result[2] += timer.GetMs(); 59 60 timer.GetMs(); 61 for (size_t i = 0; i < REAL_TABLE_SIZE / 128; i++) 62 sin(real(0.01 * i)); 63 result[3] += timer.GetMs() * 128; 64 65 timer.GetMs(); 66 for (size_t i = 0; i < REAL_TABLE_SIZE / 128; i++) 67 exp((real)(int)(i  REAL_TABLE_SIZE / 256)); 68 result[4] += timer.GetMs() * 128; 59 69 } 60 70 … … 66 76 Log::Info("real = real * real %7.3f\n", result[1]); 67 77 Log::Info("real = real / real %7.3f\n", result[2]); 78 Log::Info("real = sin(real) %7.3f\n", result[3]); 79 Log::Info("real = exp(real) %7.3f\n", result[4]); 68 80 } 69 81
Note: See TracChangeset
for help on using the changeset viewer.