Skip to content

Commit 003d696

Browse files
committed
Fighting with macOS stdlib
1 parent c6e45a4 commit 003d696

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/CXX_host/example.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414

1515
#include <cmath>
16+
#include <cstdlib>
1617
#include <iostream>
1718

1819
#include <XCFun/xcfun.h>
@@ -83,7 +84,7 @@ int main(int, char **) {
8384
std::cout << "The XC energy density is " << res << std::endl;
8485

8586
// compare with reference
86-
auto diff = std::fabs(-0.86494159400066051 - res);
87+
auto diff = std::abs(-0.86494159400066051 - res);
8788
if (diff > 1.0e-6)
8889
std::cout << "derivatives do not match reference numbers" << std::endl;
8990
}
@@ -114,7 +115,7 @@ int main(int, char **) {
114115
auto res = derivative(id, vector_length, density);
115116

116117
// compare with reference
117-
auto diff = std::fabs(-5.1509916226154067 - res);
118+
auto diff = std::abs(-5.1509916226154067 - res);
118119
if (diff > 1.0e-6)
119120
std::cout << "derivatives do not match reference numbers" << std::endl;
120121
}
@@ -148,7 +149,7 @@ int main(int, char **) {
148149
auto res = derivative(id, vector_length, density);
149150

150151
// compare with reference
151-
auto diff = std::fabs(-0.013470456737102541 - res);
152+
auto diff = std::abs(-0.013470456737102541 - res);
152153
if (diff > 1.0e-6)
153154
std::cout << "derivatives do not match reference numbers" << std::endl;
154155
}
@@ -186,7 +187,7 @@ int main(int, char **) {
186187
auto res = derivative(id, vector_length, density);
187188

188189
// compare with reference
189-
auto diff = std::fabs(-9.4927931153398468 - res);
190+
auto diff = std::abs(-9.4927931153398468 - res);
190191
if (diff > 1.0e-6)
191192
std::cout << "derivatives do not match reference numbers" << std::endl;
192193
}
@@ -240,7 +241,7 @@ int main(int, char **) {
240241
auto res = derivative(id, vector_length, density);
241242

242243
// compare with reference
243-
auto diff = std::fabs(47.091223089835331 - res);
244+
auto diff = std::abs(47.091223089835331 - res);
244245
if (diff > 1.0e-6)
245246
std::cout << "derivatives do not match reference numbers" << std::endl;
246247
}

0 commit comments

Comments
 (0)