Click here to Skip to main content
15,902,938 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: strange grammar about volatile and operator overload Pin
Rajkumar R29-Jan-08 19:08
Rajkumar R29-Jan-08 19:08 
GeneralRe: strange grammar about volatile and operator overload Pin
Maxwell Chen29-Jan-08 19:30
Maxwell Chen29-Jan-08 19:30 
GeneralRe: strange grammar about volatile and operator overload Pin
Rajkumar R29-Jan-08 19:37
Rajkumar R29-Jan-08 19:37 
GeneralRe: strange grammar about volatile and operator overload Pin
Maxwell Chen29-Jan-08 19:45
Maxwell Chen29-Jan-08 19:45 
GeneralShell Contet Menu Pin
john563228-Jan-08 23:45
john563228-Jan-08 23:45 
GeneralRe: Shell Contet Menu Pin
Iain Clarke, Warrior Programmer28-Jan-08 23:55
Iain Clarke, Warrior Programmer28-Jan-08 23:55 
QuestionHow to capture shutdown notification when Windows Shutdown Pin
Abhijit A28-Jan-08 23:37
Abhijit A28-Jan-08 23:37 
AnswerRe: How to capture shutdown notification when Windows Shutdown Pin
Maxwell Chen28-Jan-08 23:42
Maxwell Chen28-Jan-08 23:42 
GeneralRe: How to capture shutdown notification when Windows Shutdown Pin
Abhijit A29-Jan-08 0:37
Abhijit A29-Jan-08 0:37 
AnswerRe: How to capture shutdown notification when Windows Shutdown Pin
Mark Salsbery29-Jan-08 5:51
Mark Salsbery29-Jan-08 5:51 
AnswerRe: How to capture shutdown notification when Windows Shutdown Pin
Stephen Hewitt29-Jan-08 12:13
Stephen Hewitt29-Jan-08 12:13 
GeneralListView item selection Pin
ilgale28-Jan-08 23:37
ilgale28-Jan-08 23:37 
GeneralRe: ListView item selection Pin
Iain Clarke, Warrior Programmer28-Jan-08 23:57
Iain Clarke, Warrior Programmer28-Jan-08 23:57 
GeneralRe: ListView item selection Pin
ilgale29-Jan-08 0:21
ilgale29-Jan-08 0:21 
GeneralUrgent Help ~!! Convert Lab to RGB Pin
azusakt28-Jan-08 23:17
azusakt28-Jan-08 23:17 
GeneralRe: Urgent Help ~!! Convert Lab to RGB Pin
Rajesh R Subramanian28-Jan-08 23:31
professionalRajesh R Subramanian28-Jan-08 23:31 
GeneralRe: Urgent Help ~!! Convert Lab to RGB [modified] Pin
azusakt29-Jan-08 15:26
azusakt29-Jan-08 15:26 
GeneralRe: Urgent Help ~!! Convert Lab to RGB Pin
CPallini28-Jan-08 23:57
mveCPallini28-Jan-08 23:57 
GeneralRe: Urgent Help ~!! Convert Lab to RGB [modified] Pin
Mr. Surprise29-Jan-08 7:35
Mr. Surprise29-Jan-08 7:35 
GeneralRe: Urgent Help ~!! Convert Lab to RGB Pin
azusakt29-Jan-08 19:10
azusakt29-Jan-08 19:10 
GeneralRe: Urgent Help ~!! Convert Lab to RGB [modified] Pin
Mr. Surprise29-Jan-08 22:07
Mr. Surprise29-Jan-08 22:07 
GeneralStoring ptint setup info Pin
g_sandipan28-Jan-08 23:12
g_sandipan28-Jan-08 23:12 
GeneralFloating point arithmetic Pin
User 345557728-Jan-08 23:12
User 345557728-Jan-08 23:12 
Check out these two code paths:
float s = 1.0f + pow(2.0f,-8.0f) + pow(2.0f,-18.0f);

float fRes1 = 1024 * s;

float fRes2 = 0.0f;
for(int i=0; i<1024; ++i)
    fRes2 +=s;


now watch the results:
fRes1: 1028.0039
fRes2: 1028.0002

This was tested on Intel Dual-core, VS2005. the direct multiplication was compiled to use fmul, the accumulation was compiled to use fadd. The scalar value s was crafted to know analytically which is the correct result. it is fRes1 (the fmul result).

Can anyone shed some light on the source of the difference??

it can't be (i think) a direct precision issue - all arguments and intermediate values are *exactly* representable in single precision.


any insight would be greatly appreciated!

-Ofek

modified 23-Jan-21 21:03pm.

GeneralRe: Floating point arithmetic Pin
Maxwell Chen28-Jan-08 23:32
Maxwell Chen28-Jan-08 23:32 
GeneralRe: Floating point arithmetic Pin
CPallini28-Jan-08 23:36
mveCPallini28-Jan-08 23:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.