# computing log2 in j2me

Fred Grott

Ranch Hand

Posts: 346

posted 13 years ago

I want to speed up math in j2me by shiting and thus need to know how to compute log2 but as you know we do not have access ot Math.log

so how do we do it?

any ideas?

so how do we do it?

any ideas?

MobileBytes blog - Sharing Technology - My Programming Knols

Daniel Moore

Ranch Hand

Posts: 31

posted 13 years ago

Boy, I don't know how to compute log2 without access to Math.log, but some algorithm books might be able to help. I'd check out "Numerical Recipes in C," or maybe the "Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Table".

Good luck.

[ December 12, 2003: Message edited by: Daniel Moore ]

Good luck.

[ December 12, 2003: Message edited by: Daniel Moore ]

<a href="http://www.mooreds.com/weblog/" target="_blank" rel="nofollow">http://www.mooreds.com/weblog/</a>

Fred Grott

Ranch Hand

Posts: 346

posted 13 years ago

Thanks Daniel..

ways I have rruled out so far..

store value in array..too much memory

I will probalby have to go the way of numerical approximation

which if I am avoding a divisio might work but on multiplication would not thus would only be able to use a number shift log2 on division..but stil saves soem extra steps and thus speeds up the code...

ways I have rruled out so far..

store value in array..too much memory

I will probalby have to go the way of numerical approximation

which if I am avoding a divisio might work but on multiplication would not thus would only be able to use a number shift log2 on division..but stil saves soem extra steps and thus speeds up the code...

MobileBytes blog - Sharing Technology - My Programming Knols

Fred Grott

Ranch Hand

Posts: 346

posted 13 years ago

you can see my solution at top of sat's post:

http://www.jroller.com/page/shareme/20031213

http://www.jroller.com/page/shareme/20031213

MobileBytes blog - Sharing Technology - My Programming Knols