Click here to Skip to main content
15,911,785 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: algorithms??? Pin
Peter_in_27801-Dec-12 19:34
professionalPeter_in_27801-Dec-12 19:34 
QuestionRe: algorithms??? Pin
April Fans27-Dec-12 4:17
April Fans27-Dec-12 4:17 
NewsWilling to Trade Ad Space on My site for work on my site Pin
Beyslist114-Nov-12 17:15
Beyslist114-Nov-12 17:15 
QuestionNeed a Classified Ad Aggregator Algorithm Pin
Beyslist114-Nov-12 17:14
Beyslist114-Nov-12 17:14 
Questionfinding the best algorithm Pin
speedchandu20-Oct-12 11:32
speedchandu20-Oct-12 11:32 
AnswerRe: finding the best algorithm Pin
Alan Balkany22-Oct-12 5:00
Alan Balkany22-Oct-12 5:00 
GeneralRe: finding the best algorithm Pin
speedchandu22-Oct-12 20:12
speedchandu22-Oct-12 20:12 
GeneralRe: finding the best algorithm Pin
_Kel_22-Oct-12 23:36
_Kel_22-Oct-12 23:36 
To elaborate on Alan's suggestion...


Let's take a big power of 2, such as:
2 ^ 2000

We first re-express it using a power of 10:
10 ^ (2000 * log10 (2))

Which yields:
10 ^ 602.05999132796239042747778944899

But we want it re-expressed in the more useful form of: man * 10^exp, the scientific notation (just in case).

We know that x^(a+b) == (x^a) * (x^b), where x=10 and (conveniently) a and b can be the integer and the fractional parts of 602.05999132796239042747778944899

In other words:
10 ^ (602 + 0.05999132796239042747778944899) == (10 ^ 602) * (10 ^ 0.05999132796239042747778944899)

We can rearrange it in:
10 ^ 0.05999132796239042747778944899 * 10 ^ 602

Which yields:
1.1481306952742545242328332011881 * 10 ^ 602

And that's the result of 2 ^ 2000:
1.1481306952742545242328332011881e+602

You may calculate this with fixed math, but you won't get as many ULPs and it'll take more time. Either way you're going to get an approximation of the sought value.



The above also works with smaller powers.
A quick demonstration for:
5^3 = 125

Here:
5^3 = 10 ^ (3 * log10 (5))
5^3 = 10 ^ 2.0969100130080564143587833158265
5^3 = 10 ^ (2 + 0.0969100130080564143587833158265)
5^3 = (10 ^ 2) * (10 ^ 0.0969100130080564143587833158265)
5^3 = 10 ^ 0.0969100130080564143587833158265 * 10 ^ 2
5^3 = 1.2499999999999999999999999999985 * 10 ^ 2
5^3 = 1.2499999999999999999999999999985e+2

If we account for the rounding error it becomes familiar:
5^3 = 1.25e+2
5^3 = 125


[edited to improve explanation]

modified 23-Oct-12 6:43am.

GeneralRe: finding the best algorithm Pin
AshrafKawarezmey14-Nov-12 4:57
AshrafKawarezmey14-Nov-12 4:57 
AnswerRe: finding the best algorithm Pin
YvesDaoust22-Oct-12 21:41
YvesDaoust22-Oct-12 21:41 
AnswerRe: finding the best algorithm Pin
YvesDaoust22-Oct-12 22:11
YvesDaoust22-Oct-12 22:11 
GeneralRe: finding the best algorithm Pin
Peter_in_27802-Dec-12 14:45
professionalPeter_in_27802-Dec-12 14:45 
GeneralRe: finding the best algorithm Pin
YvesDaoust2-Dec-12 20:59
YvesDaoust2-Dec-12 20:59 
GeneralRe: finding the best algorithm Pin
Peter_in_27802-Dec-12 23:34
professionalPeter_in_27802-Dec-12 23:34 
GeneralRe: finding the best algorithm Pin
YvesDaoust3-Dec-12 0:15
YvesDaoust3-Dec-12 0:15 
GeneralRe: finding the best algorithm Pin
YvesDaoust2-Dec-12 21:40
YvesDaoust2-Dec-12 21:40 
QuestionSplitting up multiple readings... Pin
glennPattonWork39-Oct-12 0:50
professionalglennPattonWork39-Oct-12 0:50 
GeneralRe: Splitting up multiple readings... Pin
harold aptroot9-Oct-12 0:57
harold aptroot9-Oct-12 0:57 
GeneralRe: Splitting up multiple readings... Pin
glennPattonWork39-Oct-12 1:27
professionalglennPattonWork39-Oct-12 1:27 
GeneralRe: Splitting up multiple readings... Pin
harold aptroot9-Oct-12 1:35
harold aptroot9-Oct-12 1:35 
GeneralRe: Splitting up multiple readings... Pin
Pete O'Hanlon9-Oct-12 2:05
mvePete O'Hanlon9-Oct-12 2:05 
GeneralRe: Splitting up multiple readings... Pin
glennPattonWork39-Oct-12 2:36
professionalglennPattonWork39-Oct-12 2:36 
GeneralRe: Splitting up multiple readings... Pin
Pete O'Hanlon9-Oct-12 2:45
mvePete O'Hanlon9-Oct-12 2:45 
GeneralRe: Splitting up multiple readings... Pin
Jochen Arndt9-Oct-12 3:09
professionalJochen Arndt9-Oct-12 3:09 
GeneralRe: Splitting up multiple readings... Pin
glennPattonWork39-Oct-12 4:34
professionalglennPattonWork39-Oct-12 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.