~ubuntu-branches/ubuntu/saucy/libwpd/saucy

« back to all changes in this revision

Viewing changes to src/lib/libwpd_math.cpp

  • Committer: Package Import Robot
  • Author(s): Rene Engelhard
  • Date: 2011-11-29 23:31:13 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20111129233113-xdtwca9h0y6wdxst
Tags: 0.9.4-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
1
2
/* libwpd
2
3
 * Copyright (C) 2003 David Mandelin (mandelin@cs.wisc.edu)
3
4
 * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
4
 
 *  
 
5
 *
5
6
 * This library is free software; you can redistribute it and/or
6
7
 * modify it under the terms of the GNU Library General Public
7
8
 * License as published by the Free Software Foundation; either
19
20
 * For further information visit http://libwpd.sourceforge.net
20
21
 */
21
22
 
22
 
/* "This product is not manufactured, approved, or supported by 
 
23
/* "This product is not manufactured, approved, or supported by
23
24
 * Corel Corporation or Corel Corporation Limited."
24
25
 */
25
26
 
27
28
 
28
29
#if defined(_WIN32) && !defined(__MINGW32__)
29
30
 
30
 
double rint(double x) 
 
31
double rint(double x)
31
32
{
32
33
        double y, z;
33
34
        int n;
34
35
 
35
 
        if(x >= 0) 
 
36
        if(x >= 0)
36
37
        {
37
38
                y = x + 0.5;
38
39
                z = floor(y);
39
40
                n = static_cast<int>(z);
40
41
                if (y == z && n % 2) --z;
41
 
        } 
42
 
        else 
 
42
        }
 
43
        else
43
44
        {
44
45
                y = x - 0.5;
45
46
                z = ceil(y);
50
51
}
51
52
 
52
53
#endif
 
54
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */