"I don't understand" is a poor excuse for giving up.
Well there is no way at least based on the replies I got over hear to write assembly code which takes variables from outside in Arduino IDE. let's say I have "uint8_t a;" how do I use this in my assembly code? This is why I gave up on it. If there is no way around that, nothing can be done as far I am concerned and in replies here and outside I could not find any solution for this problem.
Figuring it out would be a better use of time than re-writing it. As you say, adding a "max field width" to the ftoa_engine should be relatively trivial
Actually __ftoa_engine returns the exponent in decimal and the number digits as much as it is requested by the user (max) in a buffer. It is like scientific form but with exponent part being an integer. That is why I was hoping to find a way to use that in arduino IDE. But everything I tried failed. I even tried to copy paste the assembly code to get it working but due to the problem in previous paragraph it is not possible.
for more info on __ftoa_engine check:
https://sourcecodebrowser.com/avr-libc/1.8.0/ftoa__engine_8h.html#a0700887e129ad889bdff83eac78c8797
#include <avr/io.h>
I faced other problems before getting to io.h as stated above.
"__ftoa_engine" is an internal function which IDE does not let me use it. It says it is not defined in this scope. I tried to add the related .h files but that also did not work. Unless I have made a mistake.
I searched for arduin __ftoa_engine and google has less than 20 pages showing up. 2 of it being this post.