[kaffe] Can you tell me the arithmetic's theory

2006-12-12 Thread douchuan



hi
  I don't know what does the arithmetic say!
  The result from a is 1000, then the result from b is 6.
  I have optimized a system for a long time, but i find out i must 
optimize all aspects, just a aspect isn't work.

  I want to know arithmetic's theory.


  a.
   long endPoints = (1000 + 1000 + 1000 + 1000 + 1000) / 5;
   if(endPoints  6208L)
   endPoints = 6208L;
   long halfEndPoints = endPoints / 2L;
   long l2 = endPoints - halfEndPoints;
   long l3 = 1L;
   l3 = 1000L*1000L*1000L*1000L*1000L;
  
   f(l3 != 0L)

   while(halfEndPoints  0L)
   {
   if(l2 * l2 * l2 * l2 * l2  l3)
   endPoints = l2;
   else
   halfEndPoints /= 2L;
   l2 = endPoints - halfEndPoints;
   }
   else
   endPoints = 0L;
  
   System.out.println(endPoints:  + endPoints);
  
  
  
   result :  1000
  
  
b.


  long endPoints = (6000 + 1 + 1 + 1 + 1) / 5;
   if(endPoints  6208L)
   endPoints = 6208L;
   long halfEndPoints = endPoints / 2L;
   long l2 = endPoints - halfEndPoints;
   long l3 = 1L;
   l3 = 6000L*1L*1L*1L*1L;
  
   f(l3 != 0L)

   while(halfEndPoints  0L)
   {
   if(l2 * l2 * l2 * l2 * l2  l3)
   endPoints = l2;
   else
   halfEndPoints /= 2L;
   l2 = endPoints - halfEndPoints;
   }
   else
   endPoints = 0L;
  
   System.out.println(endPoints:  + endPoints);
  
  
  
   result : 6


Thanks and Regards,
Do chuan

___
kaffe mailing list
kaffe@kaffe.org
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe


Re: [kaffe] Can you tell me the arithmetic's theory

2006-12-12 Thread Ito Kazumitsu
Hi,

I don't know what does the arithmetic say!
The result from a is 1000, then the result from b is 6.

I am not sure, but isn't this calculating the geometrical average
of the given five numbers: Math.pow(x1 * x2 * x3 * x4 * x5, 0.2) ?

___
kaffe mailing list
kaffe@kaffe.org
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe