shithub: sox

Download patch

ref: fc4b5addb922a43647b29060f39bce5729ca7345
parent: cdf18af4ee2c8ebda974ed8e957c979ce0599b42
author: robs <robs>
date: Sat Nov 22 11:19:02 EST 2008

fix epsilon issues apparent on cygwin

--- a/src/sox_sample_test.h
+++ b/src/sox_sample_test.h
@@ -143,6 +143,8 @@
   #pragma warning(push, 1)
 #endif
 
+#define epsilon 1e-16
+
 int main()
 {
   int8_t int8;
@@ -178,17 +180,17 @@
   sample = SOX_FLOAT_64BIT_TO_SAMPLE(d, clips);
   assert(sample == -SOX_SAMPLE_MAX && clips == 0);
   d = SOX_SAMPLE_TO_FLOAT_64BIT(sample,clips);
-  assert(d == -1 && clips == 0);
+  assert(fabs(d + 1) < epsilon && clips == 0);
 
   --sample;
   d = SOX_SAMPLE_TO_FLOAT_64BIT(sample,clips);
-  assert(d == -1 && --clips == 0);
+  assert(fabs(d + 1) < epsilon && --clips == 0);
 
   d = 1;
   sample = SOX_FLOAT_64BIT_TO_SAMPLE(d, clips);
   assert(sample == SOX_SAMPLE_MAX && clips == 0);
   d = SOX_SAMPLE_TO_FLOAT_64BIT(sample,clips);
-  assert(d == 1 && clips == 0);
+  assert(fabs(d - 1) < epsilon && clips == 0);
 
   d = 1.0000000001;
   sample = SOX_FLOAT_64BIT_TO_SAMPLE(d, clips);