diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2012-02-16 01:08:05 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-03-12 13:27:36 +0000 |
commit | a7a180366686298fa7f7aae686152e5a759d3a89 (patch) | |
tree | baec074baa4e89f18314c226bf3c528bbb1ef6a2 /fitz | |
parent | 5e31bc05a0299033dad386ea346c6c8503125113 (diff) | |
download | mupdf-a7a180366686298fa7f7aae686152e5a759d3a89.tar.xz |
Take care of boundary conditions in ps function evaluation.
Floating point numbers are now clamped, division by zero is
approximated by minimum or maximum value and NaN results in 1.0.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/fitz.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fitz/fitz.h b/fitz/fitz.h index 594bc4e9..d80204f0 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -15,7 +15,7 @@ #include <assert.h> #include <errno.h> #include <limits.h> /* INT_MAX & co */ -#include <float.h> /* FLT_EPSILON */ +#include <float.h> /* FLT_EPSILON, FLT_MAX & co */ #include <fcntl.h> /* O_RDONLY & co */ #include <setjmp.h> @@ -46,6 +46,7 @@ #define MIN(a,b) ( (a) < (b) ? (a) : (b) ) #define MAX(a,b) ( (a) > (b) ? (a) : (b) ) #define CLAMP(x,a,b) ( (x) > (b) ? (b) : ( (x) < (a) ? (a) : (x) ) ) +#define DIV_BY_ZERO(a, b, min, max) (((a) < 0) ^ ((b) < 0) ? (min) : (max)) /* * Some differences in libc can be smoothed over @@ -62,6 +63,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz); #define snprintf _snprintf +#define isnan _isnan #else /* Unix or close enough */ |