Pure Programmer

## Project: Renard Numbers with Rounding Function

Modify the program that computes Renard numbers. Modify it so that the values stored in the array of Renard numbers are rounded instead of using formetted output to round the output used in the original solution.

The roundSigDig() function should take the floating point value to round and the number of significant digits to keep (precision). It should return a new floating point value rounded to the number of significant digits. For example 1234 rounded to two significant digits is 1200 This rounding can be accomplished by multiplying the value (n) by 10int(precision-log10(n)-1), adding 0.5, computing the integer floor, then dividing by 10int(precision-log10(n)-1) again.

See project RenardNumbers1 and [[Significant Figures]]

Output
\$ g++ -std=c++17 RenardNumbers2.cpp -o RenardNumbers2 -lfmt \$ ./RenardNumbers2 5 1 R5: 1, 2, 3, 4, 6, 10, 20, 30, 40, 60, 100, 200, 300, 400, 600, 1000 \$ g++ -std=c++17 RenardNumbers2.cpp -o RenardNumbers2 -lfmt \$ ./RenardNumbers2 5 2 R5: 1, 1.6, 2.5, 4, 6.3, 10, 16, 25, 40, 63, 100, 160, 250, 400, 630, 1000 \$ g++ -std=c++17 RenardNumbers2.cpp -o RenardNumbers2 -lfmt \$ ./RenardNumbers2 10 2 R10: 1, 1.3, 1.6, 2, 2.5, 3.2, 4, 5, 6.3, 7.9, 10, 13, 16, 20, 25, 32, 40, 50, 63, 79, 100, 130, 160, 200, 250, 320, 400, 500, 630, 790, 1000 \$ g++ -std=c++17 RenardNumbers2.cpp -o RenardNumbers2 -lfmt \$ ./RenardNumbers2 20 2 R20: 1, 1.1, 1.3, 1.4, 1.6, 1.8, 2, 2.2, 2.5, 2.8, 3.2, 3.5, 4, 4.5, 5, 5.6, 6.3, 7.1, 7.9, 8.9, 10, 11, 13, 14, 16, 18, 20, 22, 25, 28, 32, 35, 40, 45, 50, 56, 63, 71, 79, 89, 100, 110, 130, 140, 160, 180, 200, 220, 250, 280, 320, 350, 400, 450, 500, 560, 630, 710, 790, 890, 1000 \$ g++ -std=c++17 RenardNumbers2.cpp -o RenardNumbers2 -lfmt \$ ./RenardNumbers2 40 3 R40: 1, 1.06, 1.12, 1.19, 1.26, 1.33, 1.41, 1.5, 1.58, 1.68, 1.78, 1.88, 2, 2.11, 2.24, 2.37, 2.51, 2.66, 2.82, 2.99, 3.16, 3.35, 3.55, 3.76, 3.98, 4.22, 4.47, 4.73, 5.01, 5.31, 5.62, 5.96, 6.31, 6.68, 7.08, 7.5, 7.94, 8.41, 8.91, 9.44, 10, 10.6, 11.2, 11.9, 12.6, 13.3, 14.1, 15, 15.8, 16.8, 17.8, 18.8, 20, 21.1, 22.4, 23.7, 25.1, 26.6, 28.2, 29.9, 31.6, 33.5, 35.5, 37.6, 39.8, 42.2, 44.7, 47.3, 50.1, 53.1, 56.2, 59.6, 63.1, 66.8, 70.8, 75, 79.4, 84.1, 89.1, 94.4, 100, 106, 112, 119, 126, 133, 141, 150, 158, 168, 178, 188, 200, 211, 224, 237, 251, 266, 282, 299, 316, 335, 355, 376, 398, 422, 447, 473, 501, 531, 562, 596, 631, 668, 708, 750, 794, 841, 891, 944, 1000

Solution