Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

How to convert very long numbers (more specifically long double) to integers

$
0
0

Hello

I was solving this question where a very large number 16^123 is involved. As I have a habit of 'seeing' everything as programming problems, I realized that if I can just calculate 16^123 which is 22142024630120207368183773162315510695991025691578204136484229989042903038958701481563926559866088068 690875167586818560952715154383806383816600300027904 and then take its modulus by 257, I get the answer. But the data type required to store such a huge number is probably long double and any data type involving floating points cannot be used in modulo arithmetic.

So, I was wondering if there was a way that such huge numbers can be converted to integers( or numbers without decimals) and still modulo arithmetic be used on it?

Thanks


Viewing all articles
Browse latest Browse all 40121

Trending Articles