Unix to Windows Porting Dictionary for HPC

Links

Function List

llrint


Unix

header file: math.h

long long llrint(double x);
long long llrintf(float x);
long lrint(double x);
long lrintf(float x);

Windows

header file: math_u.h

long long llrint(double x);
long long llrintf(float x);
long lrint(double x);
long lrintf(float x);

Purpose

These are a set of functions that convert float and double type variables to integers of types long (32-bit) and long long (64-bit).

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;
float myfloat;
long mylong
long long mylonglong;

/* These two functions both have a double type as the argument */
mylonglong = llrint(mydouble);
mylong = lrint(mydouble);

/* These two functions both have a float type as the argument */
mylonglong = llrintf(myfloat);
mylong = lrintf(myfloat);
    
blog comments powered by Disqus