tesseract
3.03
|
00001 00002 // File: mathfix.h 00003 // Description: Implement missing math functions 00004 // Author: zdenop 00005 // Created: Fri Feb 03 06:45:06 CET 2012 00006 // 00007 // (C) Copyright 2012, Google Inc. 00008 // Licensed under the Apache License, Version 2.0 (the "License"); 00009 // you may not use this file except in compliance with the License. 00010 // You may obtain a copy of the License at 00011 // http://www.apache.org/licenses/LICENSE-2.0 00012 // Unless required by applicable law or agreed to in writing, software 00013 // distributed under the License is distributed on an "AS IS" BASIS, 00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 // See the License for the specific language governing permissions and 00016 // limitations under the License. 00017 // 00019 00020 #ifndef VS2008_INCLUDE_MATHFIX_H_ 00021 #define VS2008_INCLUDE_MATHFIXT_H_ 00022 00023 #ifndef _MSC_VER 00024 #error "Use this header only with Microsoft Visual C++ compilers!" 00025 #endif 00026 00027 #include <math.h> 00028 #include <float.h> // for _isnan(), _finite() on VC++ 00029 #define isnan(x) _isnan(x) 00030 #define isinf(x) (!_finite(x)) 00031 #define fmax max //VC++ does not implement all the provisions of C99 Standard 00032 #define round(x) roundf(x) 00033 inline float roundf(float num) { return num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f); } 00034 00035 #endif // VS2008_INCLUDE_MATHFIXT_H_