Rockbox mail archive
Subject: Re: Math in Rockbox
lear@algonet.se wrote:
> For an upcoming patch, I need some fixed- or floating-point math. Does
anyone have
> a good fixed-point implementation of pow(10, x) (or exp10(x)), or some
hints
> on how to implement it? It doesn't need to be particularly fast; small
size
> is to be preferred actually.
If x is an integer value, use one of the algorithms already given (lookup
table or while loop). If x can be fixed point as well, you could use some
kind of taylor approximation:
e^x = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
with 10^x = (e^n)^x = e^(n*x)
and n = ln 10 = 2.302585093
for an implementation see
http://people.csail.mit.edu/hqm/imode/fplib/FP.java.html
Andreas
_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox
Received on Thu Jul 7 08:35:39 2005
Page was last modified "Jan 10 2012" The Rockbox Crew
|