瀏覽代碼

Use fabs instead of abs for double values. Also add missing include.

Terry Cojean 9 年之前
父節點
當前提交
7c9d8feb8f
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      examples/pi/pi_redux.c

+ 2 - 1
examples/pi/pi_redux.c

@@ -26,6 +26,7 @@
 
 #include <starpu.h>
 #include <stdlib.h>
+#include <math.h>
 
 #define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 #define PI	3.14159265358979323846
@@ -405,7 +406,7 @@ int main(int argc, char **argv)
 
 	starpu_shutdown();
 
-	if (abs(pi_approx - PI) > 1.0)
+	if (fabs(pi_approx - PI) > 1.0)
 		return 1;
 
 	return 0;