Float Unaccuracy Error

Hi, I have this:
So While the position of an object is not the same the Coroutine can be used, but the object gets on X:14.999 instead of X:15, is there a better way to do it??

IEnumerator Planking(Transform target)
	{
		while (target.transform.localPosition != targetpos)
	{
		if (isLookedAt)
		{
				transform.localPosition = Vector3.SmoothDamp (transform.localPosition, targetpos, ref velocity, smoothTime);
				Debug.Log (BridgeIsReadySir);
				BridgeIsReadySir = true;
				yield return null;
			}
			yield return null;
		}
		yield return null;
	}

You shouldn’t compare floats (nor vectors of floats) for inaccuracy. Instead check that the magnitude is less than some threshold. It is common to see this construct in games:

float threshold = .01f;
if ((target.transform.localPosition - targetpos).sqrMagnitude < threshold  * threshold) { /* ... */ }

You use sqrMagnitude rather than just magnitude because sqrMagnitude uses an expensive square root. The size of the threshold depends on what you’re doing.