Computation of Vector3.Lerp, does it check for change?

A simple question. If I have objects that use

transform.position = Vector3.Lerp(start.position, end.position, Time.time);

in void Update(). Would I need to check if the current position of the object is equal to the destination to stop the execution of the interpolation, or does the Vector3.Lerp already handle this?

EDIT:
I have the function working as intended, I am just wondering if I should make sure that it isn’t called when it isn’t needed.

Lerp will only give an interpolation ranging from the start to the finish based on that third parameter (0 being the start, 1 being the finish) so it will never go past the end point. However, as a note, since Time.time is seconds since the application started, it is likely over 1, which is getting capped, and instantly snapping your object to the end position. Instead try a variable starting at 0 and incrementing by Time.deltaTime every frame. this should give you a smooth movement from one to the other.

–EDIT–

To clearly answer the question: No Lerp does not stop executing when you reach your destination. You will want to put in logic to check for reaching the destination, and skipping the lerp call when it is no longer needed.

You should generally not use Update if you want something to happen only some of the time, since Update always runs every frame (and has overhead each time it’s called). Use a coroutine instead, that way you can make it stop running when you’re done.

Lerp is just a simple math function. There’s pretty much one way to write it, and you can decide for yourself when to skip it:

Vector3 Lerp(Vector3 P1, Vector3 P2, float pct) {
  if(pct<=0) return P1;
  if(pct>=1) return P2;
  return P1 + (P2-P1)*pct;
}