Skip to content

Conversation

MatiPl01
Copy link
Member

Summary

The previous implementation unnecessarily used the O(n) loop to find the current interpolation value instead of using a simple binary search. It also Used unnecessary check if length of the input range is greater than 2 as this case doesn't have to be handled separately.

@MatiPl01 MatiPl01 self-assigned this Oct 15, 2025
Comment on lines +196 to +202
if (x > inputRange[length - 1]) {
narrowedInput = {
leftEdgeInput: inputRange[length - 2],
rightEdgeInput: inputRange[length - 1],
leftEdgeOutput: outputRange[length - 2],
rightEdgeOutput: outputRange[length - 1],
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be checked right away, not only when length > 2. For length == 2 it will work the same as in the previous implementation.

@MatiPl01 MatiPl01 requested review from tjzel and tomekzaw October 15, 2025 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant