Original Post
Hello, I'm interested in the relative speed of various math operations and comparison tests on a 32-bit CPU, for both integers and floats. By math operations, I mean things like: -addition -subtraction -multiplication -division -sqrt() -sin(), cos(), tan() -asin(), acos, atan() -exp() -pow() -modulus (%) -abs() -etc. And by comparsions, I mean comparing integer and floating point values (==, >, <, etc) I am interested in commonly used modern PC CPUs, from the past 5 years (Intel and AMD). Now I know that each CPU is unique and that plenty of other things affect an operation's speed, like how things are stored and moved around in memory, cacheing, and potential for parallel operations. Also, for each specific processor, there may be very detailed, very technical documentation (and I also have the option of trying to write test programs for any processor I have in my possession to generate some raw data). But I don't need something so specific - neither specific numbers, nor for a specific, certain processor. So what I'm looking for is general, relative factors. For instance, everyone says sqrt() is expensive, or that floating-point multiplication is faster than floating-point division. But how much faster are these operations compared to one another? An answer like "sqrt() is roughly ten times slower than division, which itself is roughly 3-4 times slower than multiplication" is certainly sufficient for my purposes - I just want a good feel for these kinds of things. Anything like that will help - an article, a table, etc. Does anyone know what resource might have this information, in relatively non-technical, non-specific terms? Thank you. EDIT: This probably shouldn't affect anything, as I'm interested in raw CPU capabilities, but the code I write and read about is C++.