Answer the question
In order to leave comments, you need to log in
No backtrace when debugging gdb in docker. What additional libraries or options to install?
based on debian:wheezy FROM image
installed: apt-get install gcc , g++, make, gdb
program compiles normally
program compiled in docker crashes, it works fine on localhost (debugging also works), when run in debugger (gdb) no stack. Debug options ( -ggdb ) on compilation and build added.
During startup program terminated with signal SIGSEGV, Segmentation fault.
(gdb) bt
No stack.
What might be missing?
Answer the question
In order to leave comments, you need to log in
The point here is that you do not need to re-count what you have already considered. Namely - all these sums of degrees. Each next amount is the previous amount plus one more value. A separate method is not needed, it is enough to declare a variable outside the loop and add the value of the next degree at each iteration:
function movie(card, ticket, perc) {
let
sum = card,
count = 0;
while (Math.ceil(sum) >= ticket * count) {
count++;
sum += ticket * Math.pow(perc, count);
}
return count;
}
Debug options ( -ggcc ) on compilation and build added.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question