Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Algorithm for decimal base conversation

OP alex-p690

28th August 2014, 11:54 PM   |  #1  
OP Member
Flag Pitesti
Thanks Meter: 10
 
79 posts
Join Date:Joined: Jun 2012
More
Hello guys,
For some days I'm trying to convert a double from any base to another ( tipically 2, 10 or 16), but with no luck. I thought it will be easy to find a library or some kind of an api.

I only could find convert Integer valueas or BigInteger but they had no fractional part so it is pointless. Unfortunately the Double class or the BigDecimal does not have the base convertion.

I have thought about dividing 2 numbers in that particular base, but again the BigDecimal does not have this feature like BigInteger does.

Wich is the apropiate way to this as I'm thinking about it for a couple of days and manually I'm losing way too much precision (or I implemented it poorly)?

Can you please teach me how to do this?

Thank you!

Sent from my Nexus 5 using XDA Free mobile app
29th August 2014, 10:31 PM   |  #2  
yoavst's Avatar
Senior Member
Flag Ramat Gan
Thanks Meter: 317
 
497 posts
Join Date:Joined: Jan 2013
Donate to Me
More
http://stackoverflow.com/questions/2...umbers-in-java
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes