What is the formula used to calculate the value of bitcoin-cli estimatefees?

Studying the output of bitcoin-cli estimatefees as a black box, the formula at work seems to be a moving average calculated over the previous X blocks. I cannot deduce X, nor if it is a simple moving average or an exponential moving average.

QUESTION: what is the formula used to calculate the value of bitcoin-cli estimatefees?

Thanks in advance.

Recent Questions – Bitcoin Stack Exchange