mirror of
https://github.com/13hannes11/UU_la_parallel_programming_practical_assignments.git
synced 2024-09-04 00:50:58 +02:00
12 lines
218 B
C++
12 lines
218 B
C++
#include <math.h>
|
|
|
|
// Get the Square root of a number.
|
|
double squareRoot(const double a)
|
|
{
|
|
double b = sqrt(a);
|
|
if(b != b) // NaN check
|
|
{ return -1.0; }
|
|
else
|
|
{ return sqrt(a); }
|
|
}
|