Locations not registering as equal

Okay, I’m making a Pong game. I am doing most of the code from scratch. At the moment there is only one Paddle. The issue is, the ball doesn’t seem to register when it hits the Paddle. Here is my code for the ball:`using UnityEngine;
using System.Collections;

public class BounceScript : MonoBehaviour {

public float xPosition = -9;
public float xDiffer = 0;
public float latSpeed = 10.0f;
public float vertSpeed = 10.0f;
public float yBound = 10.0f;
public float xBound = 10.0f;
PlayerControl reference;
private Vector2 vel;
private Rigidbody2D rb2d;

// Use this for initialization
void Start () {
	rb2d = GetComponent<Rigidbody2D> ();

	//reference = GameObject.Find ("PlayerSprite").GetComponent<PlayerControl>().yPos;
}

// Update is called once per frame
void Update () {
	var pos = transform.position;
	if (pos.y > yBound) {
		pos.y = yBound;
		vertSpeed = -vertSpeed;
	}else if (pos.y < -yBound) {
		pos.y = -yBound;
		vertSpeed = -vertSpeed;
	}
	if (pos.x > xBound) {
		pos.x = xBound;
		latSpeed = -latSpeed;
	}else if (pos.x < -xBound) {
		pos.x = -xBound;
		latSpeed = -latSpeed;
	}
	if (pos.y >= (PlayerControl.yPos - .48) && pos.y <= (PlayerControl.yPos + .48)) {
		Debug.Log("Y Accurate");
		if (pos.x == (-8.25)) {
			Debug.Log ("Player Hit");
		}
	}
	transform.position = pos;

	vel = rb2d.velocity;
	vel.y = vertSpeed;
	vel.x = latSpeed;
	rb2d.velocity = vel;
    }
}

And for the Paddle:

using UnityEngine;
using System.Collections;

public class PlayerControl : MonoBehaviour {

	static public float xPos;
	static public float yPos;
	public KeyCode upKey = KeyCode.W;
	public KeyCode downKey = KeyCode.S;
	public float speed = 10.0f;
	public float yBound = 10.0f;
	private Rigidbody2D rb2d;

	// Use this for initialization
	void Start () {
		rb2d = GetComponent<Rigidbody2D> ();
	}
	
	// Update is called once per frame
	void Update () {
		var vel = rb2d.velocity;
		if (Input.GetKey (upKey)) {
			vel.y = speed;
		}else if (Input.GetKey (downKey)) {
			vel.y = -speed;
		}else if (!Input.anyKey) {
			vel.y = 0;
		}
		rb2d.velocity = vel;

		var playerPos = transform.position;
		if (playerPos.y > yBound) {
			playerPos.y = yBound;
		}else if (playerPos.y < -yBound) {
			playerPos.y = -yBound;
		}
		transform.position = playerPos;
		yPos = playerPos.y;
		xPos = playerPos.x;
	}

}

Were as I get “Y accurate” consistently, “Player Hit” does not get triggered once. Any advice would be appreciated.

This is an issue with how floating point numbers are handled in computers. Any float value that isn’t a power of two (or some multiple of a power of two) cannot be accurately represented. That’s why on old calculators if you type “1 / 10” you get 1.000000000001.
As such, unless you have a very good reason to, you should never check for equality on floating point numbers. They will almost never be equal.

You can use Mathf.Approximately to do your check without changing any of your logic. It checks that the two numbers are within a small amount (usually, the smallest representable amount) of one another.

Additionally, in C# note that 3.14 is a double type and 3.14f is a float type. There’s rarely a reason to use doubles in Unity and the Mathf library functions only work on float types.