Skip to content

Commit

Permalink
Include math.h with lround implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Apr 28, 2006
1 parent 949054e commit 56f70ec
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vvp/main.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: main.cc,v 1.42 2006/04/28 15:40:30 steve Exp $"
#ident "$Id: main.cc,v 1.43 2006/04/28 15:44:37 steve Exp $"
#endif

# include "config.h"
Expand Down Expand Up @@ -59,12 +59,13 @@ extern "C" const char*optarg;
* it ourselves here. It is simply the nearest integer, rounded away
* from zero.
*/
# include <math.h>
extern "C" long int lround(double x)
{
if (x >= 0.0)
return floor(x+0.5);
return (long)floor(x+0.5);
else
return ceil(x-0.5);
return (long)ceil(x-0.5);
}
#endif

Expand Down Expand Up @@ -296,6 +297,9 @@ int main(int argc, char*argv[])

/*
* $Log: main.cc,v $
* Revision 1.43 2006/04/28 15:44:37 steve
* Include math.h with lround implementation.
*
* Revision 1.42 2006/04/28 15:40:30 steve
* lround takes double, not float.
*
Expand Down

0 comments on commit 56f70ec

Please sign in to comment.