tesseract  4.00.00dev
mathfix.h
Go to the documentation of this file.
1 // File: mathfix.h
3 // Description: Implement missing math functions
4 // Author: zdenop
5 // Created: Fri Feb 03 06:45:06 CET 2012
6 //
7 // (C) Copyright 2012, Google Inc.
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 //
19 
20 #ifndef VS2008_INCLUDE_MATHFIX_H_
21 #define VS2008_INCLUDE_MATHFIXT_H_
22 
23 #ifndef _MSC_VER
24 #error "Use this header only with Microsoft Visual C++ compilers!"
25 #endif
26 
27 #include <math.h>
28 #include <float.h> // for _isnan(), _finite() on VC++
29 
30 #if _MSC_VER < 1800
31 #define isnan(x) _isnan(x)
32 #define isinf(x) (!_finite(x))
33 #define fmax max //VC++ does not implement all the provisions of C99 Standard
34 #define round(x) roundf(x)
35 inline float roundf(float num) { return num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f); }
36 #endif
37 
38 #endif // VS2008_INCLUDE_MATHFIXT_H_
float roundf(float num)
Definition: mathfix.h:35