File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ Change Log -- Ray Tracing in One Weekend
1717- Fix: Introduce ` u ` ,` v ` surface coordinates to ` hit_record ` (#441 )
1818- Fix: Add highlight to new ` hittable::bounding_box() ` method (#442 )
1919
20+ ### _ The Rest of Your Life_
21+ - Fix: unitialized variable in first version of ` integrate_x_sq.cc `
22+ - Fix: remove unreferenced variables in several sample programs
23+ - Fix: correct program computation of the integral of x^2 (#438 )
24+
2025
2126----------------------------------------------------------------------------------------------------
2227# v3.0.1 (2020-03-31)
Original file line number Diff line number Diff line change 221221 #include < stdlib .h >
222222
223223 int main() {
224- int inside_circle = 0;
225- int inside_circle_stratified = 0;
226224 int N = 1000000;
227- double sum;
225+ auto sum = 0.0 ;
228226 for (int i = 0; i < N ; i++) {
229227 auto x = random_double(0,2);
230228 sum + = x*x;
231229 }
232230 std::cout < < std::fixed < < std::setprecision(12);
233- std::cout < < "I = " << sum/N << '\n';
231+ std::cout < < "I = " << 2 * sum/N << '\n';
234232 }
235233 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236234 [Listing [integ-xsq-1]: <kbd>[integrate_x_sq.cc]</kbd> Integrating $x^2$]
406404 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
407405
408406 int main() {
409- int inside_circle = 0;
410- int inside_circle_stratified = 0;
411407 int N = 1000000;
412408 auto sum = 0.0;
413409 for (int i = 0; i < N ; i++) {
439435 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
440436
441437 int main() {
442- int inside_circle = 0;
443- int inside_circle_stratified = 0;
444438 int N = 1000000;
445439 auto sum = 0.0;
446440 for (int i = 0; i < N ; i++) {
484478 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
485479
486480 int main() {
487- int inside_circle = 0;
488- int inside_circle_stratified = 0;
489481 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
490482 int N = 1;
491483 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
You can’t perform that action at this time.
0 commit comments