Post Reply Subscribe to Thread Email Thread

Algorithm for decimal base conversation

28th August 2014, 10:54 PM |#1  
OP Member
Flag Pitesti
Thanks Meter: 10
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
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes