source: trunk/Softwares/MiBench/src/include/basicmath-round.h @ 134

Last change on this file since 134 was 117, checked in by rosiere, 15 years ago

1) Platforms : add new organization for test
2) Load_Store_Unit : add array to count nb_check in store_queue
3) Issue_queue and Core_Glue : rewrite the issue network
4) Special_Register_Unit : add reset value to register CID
5) Softwares : add multicontext test
6) Softwares : add SPECINT
7) Softwares : add MiBench?
7) Read_queue : inhib access for r0
8) Change Core_Glue (network) - dont yet support priority and load balancing scheme

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 924 bytes
Line 
1/* +++Date last modified: 05-Jul-1997 */
2
3/*
4** rounding macros by Dave Knapp, Thad Smith, Jon Strayer, & Bob Stout
5*/
6
7#ifndef ROUND__H
8#define ROUND__H
9
10#include <math.h>
11
12#if defined(__cplusplus) && __cplusplus
13
14/*
15** Safe C++ inline versions
16*/
17
18/* round to integer */
19
20inline int iround(double x)
21{
22      return (int)floor(x + 0.5);
23}
24
25/* round number n to d decimal points */
26
27inline double fround(double n, unsigned d)
28{
29      return floor(n * pow(10., d) + .5) / pow(10., d);
30}
31
32#else
33
34/*
35** NOTE: These C macro versions are unsafe since arguments are referenced
36**       more than once.
37**
38**       Avoid using these with expression arguments to be safe.
39*/
40
41/*
42** round to integer
43*/
44
45#define iround(x) floor((x) + 0.5)
46
47/*
48** round number n to d decimal points
49*/
50
51#define fround(n,d) (floor((n)*pow(10.,(d))+.5)/pow(10.,(d)))
52
53#endif
54
55#endif /* ROUND__H */
Note: See TracBrowser for help on using the repository browser.