A number 170 can be represented as a normalised form with:
1,7 as the fractional coefficient
+2 as the exponent with 10 as the base.
170 = 1,7 × 10+2
Is there a way to extract the "fractional coefficient" in a mathematical way? Without using the string representation.
var testInputs =
new double[] {
1.7E+1, // 17
1.7E+2, // 170
1.7E+3, // 1700
-1.7E+1, // -17
-1.7E+2, // -170
-1.7E+3, // -1700
1.7E-1, // 0,17
1.7E-2, // 0,017
1.7E-3, // 0,0017
-1.7E-1, // -0,17
-1.7E-2, // -0,017
-1.7E-3, // -0,0017
};
The absolute value of the fractional coefficient of those test is : 1,7.
Nb: ,
is the decimal separator.