-
Sun 2019.08.11
You beat me to it
toFixed()
@AkosLukacs, as I was in the process of documenting a discovered anomaly while prepping my response.as a mod to your example will show
>var kwh = 1234.505; >console.log(kwh.toFixed(2)) 1234.50
Is this another anomaly but withtoFixed()
? (re: "The number is rounded if necessary" )https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed
"toFixed() returns a string representation of numObj that does not use exponential notation and has exactly digits digits after the decimal place. The number is rounded if necessary, and the fractional part is padded with zeros if necessary so that it has the specified length."
YES just posted
Good catch with the division. I've now added the try/catch to see if the issue is with that.
Regarding L68, I'm not sure it is acceptable practice, but it was a trick I found to round a number to x decimal places. If that is the issue, then the try/catch should catch that, although I've been using the same snippet in other work, so I'd be surprised if that is the issue.
Thanks for the tips, I've updated the Puck code so I'll wait and see what gets logged out.