cristy | 380a11c | 2012-06-02 15:15:22 +0000 | [diff] [blame] | 1 | /* |
cristy | fe676ee | 2013-11-18 13:03:38 +0000 | [diff] [blame] | 2 | Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization |
cristy | 380a11c | 2012-06-02 15:15:22 +0000 | [diff] [blame] | 3 | dedicated to making software imaging solutions freely available. |
cristy | 39feb2b | 2012-06-08 22:37:10 +0000 | [diff] [blame] | 4 | |
cristy | 380a11c | 2012-06-02 15:15:22 +0000 | [diff] [blame] | 5 | You may not use this file except in compliance with the License. |
| 6 | obtain a copy of the License at |
cristy | 39feb2b | 2012-06-08 22:37:10 +0000 | [diff] [blame] | 7 | |
cristy | 380a11c | 2012-06-02 15:15:22 +0000 | [diff] [blame] | 8 | http://www.imagemagick.org/script/license.php |
cristy | 39feb2b | 2012-06-08 22:37:10 +0000 | [diff] [blame] | 9 | |
cristy | 380a11c | 2012-06-02 15:15:22 +0000 | [diff] [blame] | 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | |
| 16 | MagickCore image pixel private methods. |
| 17 | */ |
| 18 | #ifndef _MAGICKCORE_PIXEL_PRIVATE_H |
| 19 | #define _MAGICKCORE_PIXEL_PRIVATE_H |
| 20 | |
| 21 | #if defined(__cplusplus) || defined(c_plusplus) |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
cristy | 3e3ec3a | 2012-11-03 23:11:06 +0000 | [diff] [blame] | 25 | static inline double PerceptibleReciprocal(const double x) |
cristy | 380a11c | 2012-06-02 15:15:22 +0000 | [diff] [blame] | 26 | { |
cristy | dfa3817 | 2012-10-14 22:17:01 +0000 | [diff] [blame] | 27 | double |
| 28 | sign; |
| 29 | |
cristy | 3e3ec3a | 2012-11-03 23:11:06 +0000 | [diff] [blame] | 30 | /* |
| 31 | Return 1/x where x is perceptible (not unlimited or infinitesimal). |
| 32 | */ |
cristy | fdf6aed | 2012-10-14 22:22:17 +0000 | [diff] [blame] | 33 | sign=x < 0.0 ? -1.0 : 1.0; |
cristy | dfa3817 | 2012-10-14 22:17:01 +0000 | [diff] [blame] | 34 | if ((sign*x) >= MagickEpsilon) |
| 35 | return(1.0/x); |
cristy | fdf6aed | 2012-10-14 22:22:17 +0000 | [diff] [blame] | 36 | return(sign/MagickEpsilon); |
cristy | 380a11c | 2012-06-02 15:15:22 +0000 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | #if defined(__cplusplus) || defined(c_plusplus) |
| 40 | } |
| 41 | #endif |
| 42 | |
| 43 | #endif |