Community
cancel
Showing results for
Did you mean: Beginner
102 Views

## Performance on Prng with Intel(R) C++ Compiler

Need to now the best performance of a prng on 100 Millions floating points numbers, generated with Intel C++ Compiler.

Prng algorithm: x=n*x+n*s+s*x-INT(n*x+n*s+s*x)

For more see:

Thanks

3 Replies Black Belt
102 Views
I'll leave criticisms on technical grounds to those more expert on this subject. If you're asking about performance, either
n*(x+s)+s*x - int(n*(x+s)+s*x)
or
n*x+s*(n+x) - int(n*x+s*(n+x))
could prove faster with better control of roundoff (if you set /fp:source or similar option).
Do you capitalize INT to indicate use of an unspecified macro? Did you consider modf() ? Beginner
102 Views
Quoting - tim18
I'll leave criticisms on technical grounds to those more expert on this subject. If you're asking about performance, either
n*(x+s)+s*x - int(n*(x+s)+s*x)
or
n*x+s*(n+x) - int(n*x+s*(n+x))
could prove faster with better control of roundoff (if you set /fp:source or similar option).
Do you capitalize INT to indicate use of an unspecified macro? Did you consider modf() ?
No, INT=int; floor; fractional part...
I just want to now, if possible, the speed on Intel C++ Compiler, comparing to Intel Fortran (see: Floating Point prng on Intel Fortran for Linux and Mac forum):a small routine gives 100.000.000 in 1.3 sec.
I thing the algorithm n*x+n*s+s*x is faster thenn*(x+s)+s*x orn*x+s*(n+x), but?? Black Belt
102 Views
Quoting - vermue
No, INT=int; floor; fractional part...
I just want to now, if possible, the speed on Intel C++ Compiler, comparing to Intel Fortran (see: Floating Point prng on Intel Fortran for Linux and Mac forum):a small routine gives 100.000.000 in 1.3 sec.
I thing the algorithm n*x+n*s+s*x is faster thenn*(x+s)+s*x orn*x+s*(n+x), but??
The evident advantage of Fortran comes when you use the AINT intrinsic, with SSE2, avoiding possible unnecessary conversion and checks for (int) conversion overflow. modf() should do the same. 