jeudi 31 mars 2016

how to calculate epsilon of mpf_class

I try to improve a c++ programm by using the GMP (GNU Multiple Precision Arithmetic Library).

There is a counter variable that periodically will be increased by a result of a calculation of type double. The addition happens inside a ISR (interrupt service routine) because of this it should be fast.

Until now the counter variable is of type double which causes a problem. Some devices (running since years) reach a point where each addition fall under absorbtion so nothing happens anymore. Other devices already start to discard smaller additions.

Because this it is time to improve it by using mpf_class instead double. But in order to set the size of the mpf_class properly i need to know the ε (epsilon).

My question is: How can i calculate the epsilon of a mpf_class object?

An example(c++) of this calculation would be great.

Aucun commentaire:

Enregistrer un commentaire