File: rint.c

package info (click to toggle)
pdl 1.99988-5
  • links: PTS
  • area: main
  • in suites: slink
  • size: 3,908 kB
  • ctags: 3,426
  • sloc: perl: 15,352; ansic: 7,852; fortran: 3,327; makefile: 39; sh: 19
file content (34 lines) | stat: -rw-r--r-- 692 bytes parent folder | download | duplicates (6)
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
/*
 * Round to neareast integer
 *
 * SYNOPSIS:
 *
 * double rint(double x);
 *
 * DESCRIPTION:
 *
 * Returns the integer (represented as a double precision number)
 * nearest to x.
 *
 * Relies on floor().
 *
 * rint(x)  =  floor(x + 0.5);
 *
 * Copyright (c) 1998, Raphael Manfredi <Raphael_Manfredi@hp.com>

 All rights reserved. There is no warranty. You are allowed
 to redistribute this software / documentation under certain
 conditions. For details, see the file COPYING in the PDL
 distribution. If this file is separated from the PDL distribution,
 the copyright notice should be included in the file.

 */

#include "mconf.h"

double rint(x)
double x;
{
	return floor(x + 0.5);
}