summaryrefslogtreecommitdiff
path: root/compat/float/limits.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-14 12:19:04 +0100
committerAnton Khirnov <anton@khirnov.net>2014-03-10 10:27:17 +0100
commite854b8f9f4097a3c560b746895e9da6721aa4cdb (patch)
tree003241c26cefa79a5cbd2c27a462c42022ea9109 /compat/float/limits.h
parent8cafeb8bca5d079041739dbd72ccec0ead138eaf (diff)
Work around broken floating point limits on some systems.
The values of {FLT,DBL}_{MAX,MIN} macros on some systems (older musl libc, some BSD flavours) are not exactly representable, i.e. (double)DBL_MAX == DBL_MAX is false This violates (at least some interpretations of) the C99 standard and breaks code (e.g. in vf_fps) like double f = DBL_MAX; [...] if (f == DBL_MAX) { // f has not been changed yet [....] }
Diffstat (limited to 'compat/float/limits.h')
-rw-r--r--compat/float/limits.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/compat/float/limits.h b/compat/float/limits.h
new file mode 100644
index 0000000000..9150bc8134
--- /dev/null
+++ b/compat/float/limits.h
@@ -0,0 +1,22 @@
+/*
+ * Work around broken floating point limits on some systems.
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include_next <limits.h>
+#include <float.h>