Unix to Windows Porting Dictionary for HPC

Links

Function List

rint


Unix

header file: math.h

double rint(double x);
float rintf(float x);

Windows

header file: math_u.h

double rint(double x);
float rintf(float x);

Purpose

These two functions round to integral value in floating-point format.

Discussion

These functions are not part of the available Windows functions. A zip file containing useful math functions is provided which contains these functions. The zip file can be obtained at the link listed at the bottom of this page (More Information).

An include file (math_u.h) for setting prototypes and macro definitions is provided with the zip file.

Example of Use in Windows

#include <math_u.h>

double mydouble, drounded;
float myfloat, frounded;

drounded = rint(mydouble);
frounded = rintf(myfloat);
    
blog comments powered by Disqus