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

douchuan do.chuan at gmail.com
Tue Dec 12 00:35:49 PST 2006



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




More information about the kaffe mailing list