Skip to content
Snippets Groups Projects
Commit fa0dc68a authored by Brandon Rodriguez's avatar Brandon Rodriguez
Browse files

Implement "Problem 6"

parent 46070b11
Branches
No related merge requests found
......@@ -168,13 +168,36 @@ void problem_5() {
/**
* Problem 6
*
*
* Declare a float of "1e20".
* Print to console.
* Declare a float of "(1e20 + 3500000000)".
* Print to console.
* Declare a float of "(1e20 + (3500000000 * 1000000000))".
* Print to console.
* Declare a float of "1e20".
* Using a loop, add 3500000000 to the float, 1000000000 different times.
* Print to console.
*/
void problem_6() {
printf("\n\nProblem 6 start.\n\n");
printf("Expected Output:\n");
printf("\n");
printf("100000002004087734272\n");
printf("100000002007587734272\n");
printf("103500002052240572416\n");
printf("103500002052240572416\n");
printf("Actual Output:\n");
float test_float = 1e20;
printf("%.10lf\n", test_float);
test_float = (1e20 + 3500000000);
printf("%.10lf\n", test_float);
test_float = (1e20 + (3500000000 * 1000000000));
printf("%.10lf\n", test_float);
test_float = 1e20;
for (int index = 0; index < 1000000000; index++) {
test_float += 3500000000;
}
printf("%.10lf\n", test_float);
printf("\nProblem 6 end.\n");
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment