Treemap Test 6 Failing Despite "rect" size corresponding to "data-value"

As far as I can tell, my treemap is working fine.
I checked the “data-value” against the “data-value” of the example and it matches.

Here’s my treemap codepen: https://codepen.io/nwbnwb/full/KKMzEXv

Here’s the FCC example: https://codepen.io/freeCodeCamp/full/KaNGNR

Try removing round() in the treemapRootFunc(). The expected/got areas given in the test’s error message were just too close…

Man, Jeremy, you’re awesome. You hit the nail right on the head.

This morning after I looked over and did my best to understand the treemap test suit code (https://github.com/freeCodeCamp/testable-projects-fcc/blob/master/src/project-tests/tree-map-tests.js), I saw that they were checking the area (height * width) off the previous rect against the next rect.

Then I inspected several of my s and each one was slightly larger than the other so I still didn’t know what was causing the issue.

But, then I checked this post, saw your comment, and immediately tried your suggestion, and it worked… cowabunga!

How did you figure out that that was the issue?

I ran the tests on your codepen and looked at the error message for the failing test and noticed the values were close, just not close enough, so it had to be something small. I initially guessed it was something to do with the padding or rounding. So I compared my code to yours and it was essentially the same except for the call to round(). I commented that line and reran the tests, all passing.

I can’t count how many times I’ve had results that were close but not exact due to rounding mistakes I’ve made, so that’s the first thing I look for if numbers are close but not close enough. The round() wasn’t wrong, it’s just producing results slightly different from what that test was expecting.

That is good information to know. I need to remember that: When the numbers are close look for code that revolve around numbers.

Thank you Jeremy.