diff src/vector.c @ 85:89b516adb5df

Checked ANSI C89 compliance (basically a few ifndefs for the C99 math functions: powf, roundf etc). Added a few PD examples/tests.
author Jamie Bullock <jamie@postlude.co.uk>
date Mon, 03 Sep 2007 14:31:58 +0000
parents f913cf823628
children 757e6f99dcd7
line wrap: on
line diff
--- a/src/vector.c	Sun Sep 02 14:28:00 2007 +0000
+++ b/src/vector.c	Mon Sep 03 14:31:58 2007 +0000
@@ -27,6 +27,15 @@
 #include <string.h>
 #include <stdlib.h>
 
+#ifndef roundf
+    float roundf(float f){
+	if (f - (int)f >= 0.5) 
+	    return (float)((int)f + 1);
+	else
+	    return (float)((int)f);
+    }
+#endif
+
 #ifdef XTRACT_FFT
 
 #include <fftw3.h>
@@ -411,7 +420,7 @@
     while(n--){
 	if(freqs[n]){
 	    ratio = freqs[n] / f0;
-	    nearest = round(ratio);
+	    nearest = roundf(ratio);
 	    distance = fabs(nearest - ratio);
 	    if(distance > threshold)
 		result[n] = result[M + n] = 0.f;