• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

computing log2 in j2me

 
Fred Grott
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Daniel Moore
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Fred Grott
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Fred Grott
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can see my solution at top of sat's post:
http://www.jroller.com/page/shareme/20031213
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic