summaryrefslogtreecommitdiffstats
path: root/Tests/Tutorial/Step5/tutorial.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Tutorial/Step5/tutorial.cxx')
-rw-r--r--Tests/Tutorial/Step5/tutorial.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/Tests/Tutorial/Step5/tutorial.cxx b/Tests/Tutorial/Step5/tutorial.cxx
index 82b416f..c27da0b 100644
--- a/Tests/Tutorial/Step5/tutorial.cxx
+++ b/Tests/Tutorial/Step5/tutorial.cxx
@@ -21,12 +21,16 @@ int main (int argc, char *argv[])
}
double inputValue = atof(argv[1]);
+ double outputValue = 0;
+ if(inputValue >= 0)
+ {
#ifdef USE_MYMATH
- double outputValue = mysqrt(inputValue);
+ outputValue = mysqrt(inputValue);
#else
- double outputValue = sqrt(inputValue);
+ outputValue = sqrt(inputValue);
#endif
+ }
fprintf(stdout,"The square root of %g is %g\n",
inputValue, outputValue);