Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Using C++ operators effectively and efficiently

$
0
0
I'm trying to look into C++'s operators to see if it's possible to create a math function that executes faster than those in the STL, but less accurate, for when high precision isn't necessary (and also to expand my knowledge of some of the ones I haven't used as much, like the bitwise operators). A consideration, though, seems to be that not all operators are equal; I've heard that floating point multiplication can be very slow compared to bitwise operations.

Are there any other C++ operators that could possibly take a very long amount of time to execute, assuming that only int and float data types are used?

Also, does it take a long time to cast an int to a float and vice versa?

And, as a separate note, (for example) if there is a way to perform bitwise operations on floats, or other strange combinations, is it possible that it'll give a different result on a different machine than mine?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>