DOM attributes with decimal values randomly getting additional calculations?


#1

I have noticed that when I render anything to the DOM with a decimal value as an attribute, that DOM node attribute get additional calculations. For instance:

let value = 0.7
el.style.backgroundImage = value;

The result will come out randomly as 0.72340 or some other variation of 0.7xxxx. Even if it is a string value and not a decimal.

Or earlier I was using https://kimmobrunfeldt.github.io/progressbar.js/ to make chart/graph calculations. It requires you to use values between 0 and 1. But the calculations would come out incorrect and random each time the page was requested. So if the value was 0.3 it would come out as some random variation of 0.3xxxx.

I have tried various JS API techniques to try and keep the outcome correct. But to no avail it kept randomizing my float values.

I am honestly surprised I have never ran into this before in the little over a year I have been using Meteor, or just haven’t noticed. What’s the deal?