To further emphasise what GhostWolf is saying.
There are two forms of representing a 2D vector. You have it by dimensions (x, y) and by polar form (magnitude, angle). In reality these are both vectors, just in a different state where each dimension has a different meaning. The idea is you can convert between these two forms by passing the vector through the exponential and logarithm operations.
C^2Dvector converts a vector of from (magnitude, angle) to (x, y).
logC(2Dvector) converts a vector of form (x, y) to (magnitude, angle).
This property comes about due to how complex numbers operate. A complex number can be considered a 2Dvector of form (c, j (or i if you are from mathematics)).
What you are currently doing is...
Vector2D (diffx, diffy) = pos2 - pos1
Vector2D (magnitude, angle) = loge(Vector2D (diffx, diffy))
Vector2D (newx, newy) = e^(Vector2D (loge(speed), angle))
What Ghostwolf is proposing...
Vector2D (diffx, diffy) = pos2 - pos1
Vector2D (magnitude, angle) = loge(Vector2D (diffx, diffy))
Vector2D (newx, newy) = Vector2D (diffx, diffy) * speed / e^(magnitude)
How does this work? You know how logarithms convert the complexity of operations...
log(x^y) = y * log(x)
log(x * y) = log(x) + log(y)
The key property used is...
log(x * y) = log(x) + log(y)
log(x / y) = log(x) - log(y)
Vector2D (magnitude, angle) = loge(Vector2D (diffx, diffy))
Vector2D (0, angle) = loge(Vector2D (diffx, diffy)) - Vector2D (magnitude, 0)
Vector2D (loge(speed), angle) = loge(Vector2D (diffx, diffy)) + Vector2D (loge(speed), 0) - Vector2D (magnitude, 0)
Vector2D (loge(speed), angle) = loge(Vector2D (diffx, diffy) * e^(Vector2D (loge(speed), 0)) / e^(Vector2D (magnitude, 0)))
Substitute this in to what you are doing...
Vector2D (newx, newy) = e^(Vector2D (loge(speed), angle))
Vector2D (newx, newy) = e^(loge(Vector2D (diffx, diffy) * e^(Vector2D (loge(speed), 0)) / e^(Vector2D (magnitude, 0))))
e^loge(x) = x
Vector2D (newx, newy) = Vector2D (diffx, diffy) * e^(Vector2D (loge(speed), 0)) / e^(Vector2D (magnitude, 0))
Vectors with only the primary dimension are scalar...
Vector2D (newx, newy) = Vector2D (diffx, diffy) * e^(loge(speed)) / e^(magnitude)
Vector2D (newx, newy) = Vector2D (diffx, diffy) * speed / e^(magnitude)
Which is what Ghostwolf is doing.
e^(magnitude) is Pythagoras triangle hypotenuse length of Vector2D (diffx, diffy).
e^(magnitude) = (diffx^2 + diffy^2)^(1/2)
The reason to do this is (diffx^2 + diffy^2)^(1/2) should be mathematically simpler to compute than computing angle especially since angle is not a single number but an infinite series of numbers in theory for you see.
e^(Vector2D (magnitude, angle)) = e^(Vector2D (magnitude, angle + 2pi)) = e^(Vector2D (magnitude, angle + 4pi)) = e^(Vector2D (magnitude, angle + n * (2pi))) where n is any integer.
Any way of computing even one of these angles must be pretty complicated. When we compute angle for convenience we define it as one number, usually the closest to 0.
angle is in radians and not degrees which is why it involves 2pi and not 360.