CMake/Tests/Tutorial
Daniele E. Domenichelli 36cf8a1eb9 Tests/Tutorial: Fix when USE_MYMATH is OFF
Unit tests for the square root of "-25" currently fail when USE_MYMATH
is disabled. The "mysqrt" method in the tutorials, returns "0" for a
negative value, while "sqrt" returns "NaN", and therefore the output is
not accepted by the test.

This patch checks if the number is negative and eventually returns "0"
before calling "sqrt" or "mysqrt" to fix this issue.

Printing a NaN might cause issues with the string catched by the tests
on some platform. Therefore assume that "0" is correct and "fix" the
USE_MYMATH=OFF version by checking if the number is negative and
eventually returning "0" before calling "sqrt" or "mysqrt".
2014-10-31 11:32:24 -04:00
..
Step1 ENH: preclean some warnings 2008-03-25 11:27:18 -04:00
Step2 Tests/Tutorial: Fix when USE_MYMATH is OFF 2014-10-31 11:32:24 -04:00
Step3 Tests/Tutorial: Fix when USE_MYMATH is OFF 2014-10-31 11:32:24 -04:00
Step4 Tests/Tutorial: Fix when USE_MYMATH is OFF 2014-10-31 11:32:24 -04:00
Step5 Tests/Tutorial: Fix when USE_MYMATH is OFF 2014-10-31 11:32:24 -04:00
Step6 Tests/Tutorial: Fix when USE_MYMATH is OFF 2014-10-31 11:32:24 -04:00
Step7 Tests/Tutorial: Fix when USE_MYMATH is OFF 2014-10-31 11:32:24 -04:00