Math help: describing the fractional part of a floating-point
I need help with the math needed to describe the fractional part of a floating-point number after applying modf().
Namely, I want the fractional part to be described with two ints. One representing the fractional portion, and the other a base 10 exponent.
How can I produce frac and exp.
float is 123.0450
int integer = 123; // I get this one with modf()
int frac = 450; // I get this one as 0.0450 with modf().
int exp = -4;
The float is thus described with 3 ints:
integer + frac * 10^exp