Some hacks are allowed for working with floating point, including multiplication by a split integer. In my case, the number is the address of a table with a pre-calculated 64bit value through 4k integers - that is, everything is very precise. The table is slightly reduced, because multiplication with 128bit result is very expensive on embedded systems.
Here's the problem - number preparation turns out to be equal in cost to one cycle.
https://godbolt.org/z/3cd3xx9esThe number is parsed into three parts: 4 bits, 3 bits, 3 bits. The higher part is executed unconditionally even if it gets zero. The middle and lower parts should be ignored if there is a zero. Additionally - the middle and lower parts have an offset in the table, which must be added to the number (when the number is not zero).
The obtained result is used in a loop with step-by-step curing of the table address. The loop is necessary because of the high overhead in calling a separate function. 64 bit numbers are quite fat.
It all works here -
https://godbolt.org/z/EKrxzEE1W.
You may play with string recognition char txt[] = "9.9e-4";.
The general task is to achieve a program code size of 1 kilobyte per M3 cortex. The task is complex, so it makes sense to break it into parts. And solve it in small pieces.
To begin with it - we need to make it compotable in assembler.
uint32_t proo(int32_t degre){
int32_t rem, enc;
degre += 384;
enc = (degre >> 3) & 7;
rem = 0 - enc;
enc += 11;
enc &= rem >> 31;
rem = (degre >> 6) & 15;
degre &= 7;
if (degre != 0){
degre += 18;
rem += degre << 8;
rem += enc << 16;
}else rem += enc << 8;
return rem;
};