KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This is really a weird bug to me and it took me long time to figure out what's happening. To simplify things and reproduce, just create a empty win32 console application using VS2005 and use this code in the main method: float a = 411.00418f; float b = 1.0f; float c = 0.076279849f; unsigned short result = (unsigned short)( (a-b)/c ); unsigned short result2 = (unsigned short)( (float)((a-b)/c) ); // Debug: 5374, 5375 // Release: 5374, 5374 printf("%d, %d\n", result, result2); Why result2 shows different value in debug/release mode?
Tags (comma-separated)
Save Edits
Cancel