Concept

How do you normalize a number with a while loop in C?

ComputerScienceOne / Summation

"Let’s revisit the example from Section 4.1.1 in which we normalize a number by continually dividing it by 10 until it is in the range [1, 10). The code in Code Sample 17.5 specifically refers to the value 32145.234 but would work equally well with any non-negative value of x.\n\n1 double x = 32145.234;\n\n2 int k = 0;\n\n3 while(x > 10) {\n\n4 x = x / 10; //or: x /= 10;\n\n5 k++;\n\n6 }\n\nCode Sample 17.5.: Normalizing a Number with a While Loop in C"

Related Ideas

How do you normalize a number with a while loop in C? | ComputerScienceOne | Bifalgorithm | Bifalgorithm