Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ending value may not be exact due to floating point arithmetic. #73

Closed
mbostock opened this issue Nov 16, 2019 · 2 comments
Closed

Comments

@mbostock
Copy link
Member

In many cases in this library we use the interpolated value

a + (b - a) * t

This can return a value not equal to b when t = 1. If we want to guarantee that the exact value b is returned for t = 1, we should instead use the formula

a * (1 - t) + b * t
@mbostock
Copy link
Member Author

@Fil Should we take a crack at this?

@Fil
Copy link
Member

Fil commented Nov 19, 2019

I was under the impression that this was a kind of optimisation (doing substractions once—probably ultra negligible). Also, the substraction was a nuisance when working with Uint32 numbers…

In any case, I think having exact ends is desirable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants