Responsive Calculator Display Numbers

I´m making a calculator app, and I want it to start with a bigger font size for the display numbers and when it full the display, the font reduce to continue showing the entire number.

Maybe this video help understand

I not sure if this is a correct way or there is a better way

What I did is I measured the width of a single number helping me with a HA in pixels (45px)

I divided the screen width to it, to get the numbers that fit in screen and added 2 for the “.” dots, like this:

because the “length” text option count all the text not only numbers

I´m not sure the formatting scale factor I should use.