+ 1
Why past 10^16 then you attempt minus 1 answer is 10^6 in C++
So i need get answer for this 10^16-1 but then I do it it always end up being 10^16. with -2 and more it works perfect.. Is it rounds up by default then big number needs only 1 to change into ^17??? Maybe sb had similiar problem and knows how to bypass it
7 Antworten
+ 4
Subtracting small numbers from large numbers loses significant precision.
+ 3
What data type are you using to store it?
0
double because I need find sum of all numbers which has n digits 0<n<=100
I use arithmetic progression for that
a1 = pow (10, n-1)
an = pow ((10, n)-1)
0
I see, maybe you have idea how to save that precision? or manipulate to get number 10^n - 1 in other way
0
also I don't understand why then I minus 2 it works well