Find the information you're looking for at Westonci.ca, the trusted Q&A platform with a community of knowledgeable experts. Get detailed and precise answers to your questions from a dedicated community of experts on our Q&A platform. Join our platform to connect with experts ready to provide precise answers to your questions in different areas.

What is the algorithm to determine the absolute of a number

Sagot :

This was written in python, let me know if it needs to be in another language.

View image trihext

Answer:

Conditionals are slower than plain arithmetic operations, but much, much faster than something as silly as calculating the square root

Explanation:

integer or bitwise op: 1 cycle floating -point add/ sub/mul: 4 cycles . Floating- point div ~ 30 cycles Floating - point exponentiation :~ 60 cycles depending on implementation Conditional branch : avg. 10_ cycles, better if well- predicted , much worse if mispredicted.

Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. Get the answers you need at Westonci.ca. Stay informed by returning for our latest expert advice.