Skip to content
Snippets Groups Projects
Commit b81e4138 authored by deuce's avatar deuce
Browse files

MSVCs long double does *not* have 19 significant digits which is required

to be able to accurately cast a long long int to a long double.  Replace:
(long double)x/y
WITH
(x/y)+((long double)(x%y)/y)

Can everyone look for a problem with assuming those two are interchangeable
with the second being more accurate?
parent 5eeca829
No related branches found
No related tags found
No related merge requests found
...@@ -514,7 +514,9 @@ long double DLLCALL xp_timer(void) ...@@ -514,7 +514,9 @@ long double DLLCALL xp_timer(void)
ret=((long double)tick.HighPart*4294967296)+((long double)tick.LowPart); ret=((long double)tick.HighPart*4294967296)+((long double)tick.LowPart);
ret /= ((long double)freq.HighPart*4294967296)+((long double)freq.LowPart); ret /= ((long double)freq.HighPart*4294967296)+((long double)freq.LowPart);
#else #else
ret=((long double)tick.QuadPart)/freq.QuadPart; /* In MSVC, a long double does NOT have 19 decimals of precision */
ret=((long int)(tick.QuadPart/freq.QuadPart))
+(((long double)(tick.QuadPart%freq.QuadPart))/freq.QuadPart);
#endif #endif
} }
else { else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment