Approximate-equal-to value

Nov 28, 2011 at 3:18am
Hey everyone. I'm new here so please excuse me if I'm posting this in the wrong place. I was wondering if there was an "approximately equal to" operator in C++. Or is there a pre-existing function available for it already? I was trying to find the square root of a number without using the "sqrt" function. The problem arises when the number input has no round number as it's square root, e.g., 10.
Nov 28, 2011 at 3:19am
There is not. Just make one yourself if you need one; it shouldn't take long.
Nov 28, 2011 at 3:39am
No there isn't, and the reason is simply that there is no absolute definition what "approximately" really means.

If you're trying to find ways of obtaining rough roots more quickly than with sqrt() I suggest you look up some assembler codes that you can find online, some are several times quicker than the math.h sqrt() function, albeit less accurate.
Last edited on Nov 28, 2011 at 3:40am
Topic archived. No new replies allowed.