-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-System.Numericsbreaking-changeIssue or PR that represents a breaking API or functional change over a previous release.Issue or PR that represents a breaking API or functional change over a previous release.bughelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Description
Vector2.Lerp(value1, value2, amount) and Vector4.Lerp(value1, value2, amount) are currently implemented as value1 + (value2 - value1) * amount. However, due to floating-point rounding error this will not always return value2 when amount == 1.0f.
These should be updated to use the same algorithm as Vector3.Lerp(value1, value2, amount) which is (value1 * (1.0f - amount)) + (value2 * amount). This algorithm correctly accounts for the rounding error and also allows the algorithm to be freely optimized using FusedMultiplyAdd when available.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.Numericsbreaking-changeIssue or PR that represents a breaking API or functional change over a previous release.Issue or PR that represents a breaking API or functional change over a previous release.bughelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors