diff --git a/main.c b/main.c index c343babb3701cc4ecf3b64c22bb799e7809dc9a5..bf362bb4aecb7db9644f4aba48a4aee0e6193a00 100644 --- a/main.c +++ b/main.c @@ -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"); }