summaryrefslogtreecommitdiff
path: root/ace/OS_NS_math.inl
blob: 0637272006b1a11b0e047931415b5c765cc4d51c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- C++ -*-
//
// $Id$

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE_OS {

  ACE_INLINE double
  floor (double x)
  {
    // This method computes the largest integral value not greater than x.
    if(x > 0)
      return static_cast<long> (x);
    else if (static_cast<long> (x) == x)
      return x;
    else
      return static_cast<long>(x) - 1;
  }

  ACE_INLINE double
  ceil (double x)
  {
    // This method computes the smallest integral value not less than x.
    if (x < 0)
      return static_cast<long> (x);
    else if (static_cast<long> (x) == x)
      return x;
    else
      return static_cast<long> (x) + 1;
  }

} // ACE_OS namespace

ACE_END_VERSIONED_NAMESPACE_DECL