3 //=============================================================================
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 * @author Jesper S. M|ller<stophph@diku.dk>
9 * @author and a cast of thousands...
13 //=============================================================================
15 #ifndef ACE_OS_NS_MATH_H
16 # define ACE_OS_NS_MATH_H
18 # include /**/ "ace/pre.h"
20 # include "ace/config-all.h"
22 # if !defined (ACE_LACKS_PRAGMA_ONCE)
24 # endif /* ACE_LACKS_PRAGMA_ONCE */
26 #include "ace/os_include/os_math.h"
28 #include /**/ "ace/ACE_export.h"
30 #if defined (ACE_EXPORT_MACRO)
31 # undef ACE_EXPORT_MACRO
33 #define ACE_EXPORT_MACRO ACE_Export
37 * We inline and undef some functions that may be implemented
38 * as macros on some platforms. This way macro definitions will
39 * be usable later as there is no way to save the macro definition
40 * using the pre-processor.
42 inline double ace_log2_helper (double x
)
48 # if !defined (ACE_LACKS_LOG2)
49 return ACE_STD_NAMESPACE::log2 (x
);
52 ==================================================================
60 meaning the binary logarithm of x using the natural logarithm, for
70 ==================================================================
73 // Precomputed value of 1/log(2.0). Saves an expensive division and
74 // computing log(2.0) in each call.
75 double const _1_ln2
= 1.442695040888963407359924681002;
77 return log (x
) * _1_ln2
;
78 # endif /* !ACE_LACKS_LOG2 */
79 #endif /* defined (log2) */
83 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
87 /// This method computes the largest integral value not greater than x.
92 return ACE_STD_NAMESPACE::floor (x
);
95 #if defined (ACE_HAS_WINCE)
96 /// Windows CE has an intrinsic floor for float
101 return ACE_STD_NAMESPACE::floorf (x
);
105 /// This method computes the smallest integral value not less than x.
106 template <typename T
>
110 return ACE_STD_NAMESPACE::ceil (x
);
113 #if defined (ACE_HAS_WINCE)
114 /// Windows CE has an intrinsic ceil for float
119 return ACE_STD_NAMESPACE::ceilf (x
);
123 /// This method computes the base-2 logarithm of x.
124 ACE_NAMESPACE_INLINE_FUNCTION
125 double log2 (double x
);
127 } /* namespace ACE_OS */
129 ACE_END_VERSIONED_NAMESPACE_DECL
131 # if defined (ACE_HAS_INLINED_OSCALLS)
132 # if defined (ACE_INLINE)
134 # endif /* ACE_INLINE */
135 # define ACE_INLINE inline
136 # include "ace/OS_NS_math.inl"
137 # endif /* ACE_HAS_INLINED_OSCALLS */
139 # include /**/ "ace/post.h"
140 #endif /* ACE_OS_NS_MATH_H */