BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 12-03-2007, 09:52 PM   #1 (permalink)
New Member
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: Nextel
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Angry Math.pow() ??

Please Login to Remove!

Hello,

is there anybody who knows where RIM has hidden a method to calculate power numbers, like double x ^ double y (i.e. 2^2.3)???

In the Math class you can just find the method sqrt but no method for roots higher than 2.... that seems to be pretty ridiculous...

Is it really neccessary to write that method by myself or is there any easy way to get this operation?

Thanx for any suggestion.

Hampshire

Last edited by Hampshire : 12-03-2007 at 09:53 PM.
Offline  
Old 12-04-2007, 12:49 PM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

You'll just need to find a library out there. This one is good for non-commercial use:

J2ME tools - Float point MIDP calculations
Offline  
Old 12-04-2007, 07:41 PM   #3 (permalink)
New Member
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: Nextel
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi Richard!

thanks for the suggestion, I'm gonna try the library you suggested to use, it seems to have all methods needed. Implementing another lib seems to be the only way to solve the calculation problems. Though it's a bit awkward as these are pretty basic things and I wonder why RIM was not able to implement them.....

Anyway thanks for the suggestion!

Last edited by Hampshire : 12-04-2007 at 07:59 PM.
Offline  
Old 12-04-2007, 11:25 PM   #4 (permalink)
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah, I was trying to use Coordinates.distance() recently and it didn't appear to be working so I implemented my own distance method (using the Haversine algorithm). Used the Float11 library for Math.pow and Math.atan2 and it worked great.

Again, I think we should all start make things available to the development community. I'd like to see a library repo -- perhaps similar to a Maven repo -- full of preverified libraries that we could all use, under an unrestrictive license like MIT or Apache maybe.

To that end, if anyone has anything they'd like to contribute please send it to me and I'll host it on my web site. Also feel free to send suggestions and requests for libraries that you'd like to have available. In addition to libraries I'd also like to have a cookbook of useful examples that might not be covered in the Developer Manuals or Knowledge Base (like ksoap).
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.