V
V
Vasily Serpokryl2016-03-10 11:05:08
Mathematics
Vasily Serpokryl, 2016-03-10 11:05:08

What is the best algorithm for mathematical operations of "huge" numbers?

I'm playing with swift algorithms, I need to work with huge numbers (for example, you need to sum 10e-400 + 124e-40) What is the best method to implement string summation? For myself, I singled out summation in the binary system, but you can do it the way you were taught at school (as on a "leaflet" (an ordinary column)). So I'm wondering which one would be better. Tell?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2016-03-10
Protko @Fesor

Read about BigInt implementation
https://github.com/ibiwan/swift-bigint/blob/master... - here's an example.

V
Vladimir Martyanov, 2016-03-10
@vilgeforce

Don't reinvent the wheel. Or at least look at how they are implemented. The same OpenSSL contains an implementation of long arithmetic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question