how to calculate force direction on mouse up

Hello

I want to addforce on mouseup in the direction where I am swyping.
I coded like listed below but not working everytime.
Anybody can tell me where i am mistaking…??

I did like this.

if (Input.GetMouseButtonDown (0)) 
{
	startPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
}

if (Input.GetMouseButtonUp (0)) 
{
	endPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
	GiveForce();
}

private void GiveForce()
{
	Vector2 diff = (startPosition - endPosition);
	transform.rigidbody2D.AddForce (-diff * speed, ForceMode2D.Force);
}

You need to normalize the diff vector.

private void GiveForce()
    {

    Vector2 diff = (startPosition - endPosition);
if (diff != Vector2.zero)
{
    diff.normalize(); //not sure about the spelling
    transform.rigidbody2D.AddForce (-diff * speed, ForceMode2D.Force);
}
   }