You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But after switching to the v5.8, I realized that now it's giving 2013.999999999999 0. Is there a way to fix it without explicitly rounding the numbers?
The text was updated successfully, but these errors were encountered:
Due to floating point precision, we don’t guarantee that scale or scale.invert return exact values in the range or domain, respectively. The implementation changed in 5.8 to allow for generic transformations on continuous scales.
Why do you require exact values in your application? What I’d recommend depends on what you are trying to do.
@mbostock Thanks for the clarification. I have a logarithmic line chart where I'm selecting a range on the y axis with a brush. Inside the end event of brush, scale.invert returns 2013.999999999999 and prevents me to select the value 2014 at the top. And I don't want to round numbers coming from scale.invert in there because I also want to be able select continuous values.
Shouldn't we be able to directly get the values given in the domain? I understand that it might need to support continuous scales, but why prevent getting 2014 at all?
The code below is giving
2014 0
as an output in thev5.5
.But after switching to the v5.8, I realized that now it's giving
2013.999999999999 0
. Is there a way to fix it without explicitly rounding the numbers?The text was updated successfully, but these errors were encountered: