From mboxrd@z Thu Jan 1 00:00:00 1970 From: john@jjdev.com (John de la Garza) Date: Thu, 19 Jun 2014 22:40:53 -0400 Subject: pow calculation in kernel In-Reply-To: References: Message-ID: <20140620024052.GA4906@vega.jjdev.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Fri, Jun 20, 2014 at 09:55:02AM +0800, ?? wrote: > Hi: > > I am doing a research on D2TCP(http://dl.acm.org/citation.cfm?id=2342388), I just want to implement it into the linux kernel. When calculating the penalty function, it is p = a^d, where 0< a < 1 and 0< d < 1. Since the kernel only offers integer, so in my code, so I let a multiply 2^10. But I have no idea of calculating a^d when 0< d < 1. May be I want a approximate algorithm or other methods. Can you help me ? > thanks~ > Could you achieve this using fixed point math? you can see an example in include/linux/sched.h (search for CALC_LOAD)