mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 22:59:56 -05:00
Tests: Update CMake tutorial
Latest material from data.kitware.com -> Collections -> Courses -> CMake.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "MathFunctions.h"
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
// a hack square root calculation using simple operations
|
||||
double mysqrt(double x)
|
||||
@@ -8,19 +8,16 @@ double mysqrt(double x)
|
||||
return 0;
|
||||
}
|
||||
|
||||
double result;
|
||||
double delta;
|
||||
result = x;
|
||||
double result = x;
|
||||
|
||||
// do ten iterations
|
||||
int i;
|
||||
for (i = 0; i < 10; ++i) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
if (result <= 0) {
|
||||
result = 0.1;
|
||||
}
|
||||
delta = x - (result * result);
|
||||
double delta = x - (result * result);
|
||||
result = result + 0.5 * delta / result;
|
||||
fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result);
|
||||
std::cout << "Computing sqrt of " << x << " to be " << result << std::endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user